;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; tex indent region 1997.9 ;; latex indent region 2003.4 ;; Version 1.00 2003.5.18 ;; $Id: tex-indent-region.txt,v 1.1.1.1 2003/05/18 08:12:05 amagai Exp $ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Copyright (c) 2003 ;; New Unified Environment Research Project. All rights reserved. ;; Author: NUE Kanzen project ;; Maintainer: NUE Kanzen project ;; TeX Indent Region is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; TeX Indent Region is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with TeX Indent Region; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. M-x tex-indent-region M-x detex-indent TeX でプログラムテキストを文章中に挿入するのに便利な関数. 例えば, 次のような関数テキストがあったとき, (defmacro kz-bit-on (x &rest y) (let ((p 0)) (kz-for e y (setq p (logior p (lsh 1 e)))) (list 'logior x p))) これをリージョンで囲んで M-x tex-indent-region RET と入力すると {\smallskip\baselineskip=2.5ex%ztir-prologue \+{\quad}(def\cleartabs&{}macro kz-bit-on (x \&rest y)\cr \+{\quad}& (l\cleartabs&{}et ((p 0))\cr \+{\quad}&& (kz-for e y (setq p (logior p (lsh 1 e))))\cr \+{\quad}&& (list \'{}logior x p)))\cr \cleartabs%ztir-epilogue \smallskip%ztir-epilogue }%ztir-epilogue のような出力が得られる. 段づけをTeXのタブに変更する. & といった エスケープが必要な文字についての処理も行なう. 元に戻すには, 直後であれば C-x u (undo), ファイルに残っているような ものであればこの一連の列の前にポイントを置いて, M-x detex-indent RET と入力する. M-x latex-indent-region M-x delatex-indent 上記の関数の latex 版. LaTeX2e を使っているなら, tex-indent-region.el の 変数 latex2e-indent-region-esc-char の定義を latex-indent-region-esc-char に移すとよい. ●latex-indent-region の tips === tabbing 環境内の行間を変更する === 次の \makeatletter から \makeatother を \begin{document} の前におき, \begin{tabbing} の前に \changestretch{倍率} をいれる. \makeatletter \def\changestretch#1{% \vskip\parskip\vskip\baselineskip% \def\baselinestretch{#1}% \ifx\@currsize\normalsize\@normalsize\else\@currsize\fi \vskip-\parskip\vskip-\baselineskip} \makeatother {%ztir-prologue \changestretch{0.8} %%% 追加 \begin{tabbing}%ztir-prologue === tabbing した全体をセンタリングする === 全体をboxに閉じ込めて, boxに\centerlineを適用すればよい. \setbox0\vbox{ %%% 追加 {%ztir-prologue \begin{tabbing}%ztir-prologue . . . \end{tabbing}}%ztir-epilogue } %%% 追加 \centerline{\box0} %%% 追加 ================================================================