WATAPEDIA
--
LaTeX
-- 見出し
Last updated Mar. 14, 2008
Home
Return
PDFを表示
記事が表示されない場合は,ブラウザが非対応です.
上のPDFを表示をクリックしてください.
comp -MYPEDIA TEX- 見出し 1 見出しのレベル 見出しのレベルには次の 7 段階があります。ただし、jarticle などでは章は使えま せん。 また、これ以外に各コマンドのあとに ∗ をつけたコマンドもあります。これは番 号が出力されず、目次にも出力しない見出しです。 表 1: 見出し一覧 見出し コマンド 部 \part{名前} 章 \chapter{名前} 節 \section{名前} 小節 \subsection{名前} 小々節 \subsubsection{名前} 段落 \paragraph{名前} 小段落 \subparagraph{名前} 2 見出し番号の変更 2.1 見出し番号の出力の有無 見出し番号はデフォルトでは subsubsection までしか出ませんが、secnumdepth というカウンタの値を変えることで、番号を出力するレベルを指定することが可能 です。 見出し番号を小段落まで出力させる \setcounter{secnumdepth}{5} 2.2 見出し番号の制御 見出し番号を数えるカウンタは節であれば section、小節であれば subsection と いった具合に出力するコマンドと同じ名前が付けられている。 1 TEX 一覧へ . . comp -MYPEDIA TEX- よって、次のように入力することで、見出しの番号を任意の番号から始めること ができる。 なお、デフォルトでは paragraph などは番号が出力されませんが、カウンタ自体 は存在しています。 節番号を 3 から始める \setcounter{section}{3} また、2.1 など見出しの番号の書式を決めている命令は、\thesection のように \the をつけたものになります。よって、renewcommand でこれらを再定義すれば、 自由なスタイルの番号を付けることが可能になります。 カウンタの数字を出力したい位置には、 カウンタ名を直接書くのではなく、 \arabic{section} のように記述します。この arabic というコマンドはカウンタの数字をアラビア数字 で出力するというコマンドです。arabic の他にも表 2 のようなものがあります。 表 2: カウンタの出力書式一覧 コマンド 出力 \arabic{カウンタ名} 1,2,3,· · · \roman{カウンタ名} i,ii,iii,· · · \Roman{カウンタ名} I,II,III,· · · \alph{カウンタ名} a,b,c,· · · \Alph{カウンタ名} A,B,C,· · · \fnsymbol{カウンタ名} ∗,†,‡· · · これを踏まえて、\thesection などを再定義していきます。以下に例を示します。 節番号を A,B,C,· · · 、小節番号を A-1,A-2,· · · に変更 \renewcommand{\thesection}{\Alph{section}} \renewcommand{\thesubsection}{\thesection-\arabic{subsection}} これを応用すれば、数式番号や図の番号に節番号を付加するなども可能になる。 ちなみに、数式番号のカウンタは equation、図番号は figure、表番号は table で与え られる。 詳しくはカウンタの項目を参照1。 1カウンタ . . 2 TEX 一覧へ . . comp -MYPEDIA TEX- 3 見出し名の変更 chapter コマンドで章を作成すると、第 1 章のように出力されます。この「第」の 部分と「章」の部分はそれぞれ \prechaptername と \postchaptername で決めら れています。これらを renewcommand で再定義すれば、好きなように変更すること ができます。 同様にデフォルトの出力を変更できるものの一覧を表 3 に示します。 表 3: 変更可能な見出し名一覧 コマンド 英文クラスのデフォルト \renewcommand{\prepartname}{第} Part \renewcommand{\postpartname}{部} \renewcommand{\prechaptername}{第} Chapter \renewcommand{\postchaptername}{章} \renewcommand{\contentsname}{目次} Contents \renewcommand{\listfigurename}{図目次} List of Figures \renewcommand{\listtablename}{表目次} List of Tables \renewcommand{\refname}{参考文献 (関連図書)} References \renewcommand{\indexname}{索引} Index \renewcommand{\figurename}{図} Figure \renewcommand{\tablename}{表} Table \renewcommand{\appendixname}{付録} Appendix \renewcommand{\abstractname}{概要} Abstract 4 見出し内の数式 見出しの中に数式を記述すると、デフォルトでは数式の文字が細い書体のまま出 力されるので、変に目立ってしまいます。次のように入力することで、多少改善す ることができます。 ただし、この方法では、ベクトルと普通の文字の区別がつかなくなるなどの問題 もあります。 3 TEX 一覧へ . . comp -MYPEDIA TEX- 見出し内の数式を太文字にする 通常 \subsection*{見出しの中の正弦 $\sin x$} ボールド \subsection*{見出しの中の正弦 \boldmath$\sin x$} 通常 見出しの中の正弦 sin x ボールド 見出しの中の正弦 sin x 5 見出し文のデザイン 5.1 jarticle の場合 見出しの文の部分のデザインは、 C:\usr\local\share\texmf\tex\platex\baseの 中にある jarticle.cls というファイルの内容でデフォルトのデザインが決められてい ます。\newcommand{\section}{\@stratsec... など、このファイルの見出しを定 義している部分を参考にして、renewcommand で再定義すれば、デザインを変更す ることができます。見出しのスタイルの部分には、画像を挿入することもできます。 この定義で、\Cvs=\baselineskip (行送り幅) 、\z@=0pt を指します。\@plus や \@minus の値は、状況に合わせてその範囲での変化を許容するという意味です。ま た、見出し前の空白の値に-を付けると、続く文章のインデントが無くなり、見出し 後の空白の値に-を付けると続く文章を見出しに続けて改行しないで出力するように なります。 なお、 @を含むコマンドはプリアンブルで使う場合には\makeatletterと\makeatother で囲んでおかないと使うことができません。 以下に例を挙げます。ただし、以下の例の設定値はほとんどデフォルトのままに なっているので、そのままプリアンブルに貼り付けてもデザインは変わりません。 4 TEX 一覧へ . . comp -MYPEDIA TEX- 節のデザインの変更 3 行目:{ カウンタ名 }{ 見出しのレベル }{ インデント } 4 行目:{ 見出し前の空白 } 5 行目:{ 見出し後の空白 } 6 行目:{ 見出しのスタイル } \makeatletter \renewcommand{\section}{\@startsection% {section}{1}{0pt}% {1.5\Cvs \@plus.5\Cvs \@minus.2\Cvs}% {.5\Cvs \@plus.3\Cvs}% {\reset@font\Large\bfseries}} \makeatother 小節、小々節、段落、章段落についてはこれとまったく同じです。 一方、部については節などとは定義が異なります。一部しか理解できていないの で、詳しい解説は書きません。定義のうち、意味がわかるところのみ説明を下にま とめて書いておきます。 以下は、jarticle の場合の見出しの指定部をすべてコピーして、少し手直ししたも のです。赤字の部分が指定する部分なので、説明を参考にして適宜修正、プリアン ブルに貼り付けておけばデザインが変えられます。 \makeatletter % % %部の定義 \renewcommand{\part}{\par\addvspace{4ex}% 第 I 部の前のスペース \@afterindenttrue \secdef\@part\@spart} \def\@part[#1]#2{% \ifnum \c@secnumdepth >\m@ne \refstepcounter{part}% \addcontentsline{toc}{part}{% \prepartname\thepart\postpartname% \hspace{1zw}#1}% 目次における第 I 部と見出し文の間の空白 \else \addcontentsline{toc}{part}{#1}% \fi \markboth{}{}% {\parindent\z@\raggedright% 左寄せの指定(\centering や\raggedleft でも可) \interlinepenalty\@M\reset@font 5 TEX 一覧へ . . comp -MYPEDIA TEX- \ifnum \c@secnumdepth >\m@ne \Large\bfseries\prepartname\thepart\postpartname% 第 I 部の部分のスタイル \par\nobreak \fi \huge\bfseries#2\par}% 見出し文の部分のスタイル \nobreak\vskip3ex\@afterheading}% 見出し文の後の空白 \def\@spart#1{{% \parindent\z@\raggedright% part*について左寄せの指定 \interlinepenalty\@M\reset@font \huge\bfseries#1\par}% part*について見出し文のスタイル \nobreak\vskip3ex\@afterheading}% 見出し文の後の空白 % % %節の定義 \renewcommand{\section}{\@startsection{section}{1}{\z@}% インデント {1.5\Cvs \@plus.5\Cvs \@minus.2\Cvs}% 見出しの前の縦空白 {.5\Cvs \@plus.3\Cvs}% 見出しの後の縦空白 {\reset@font\Large\bfseries}}% 見出しのスタイル % % %小節の定義 \renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}% インデント {1.5\Cvs \@plus.5\Cvs \@minus.2\Cvs}% 見出しの前の縦空白 {.5\Cvs \@plus.3\Cvs}% 見出しの後の縦空白 {\reset@font\large\bfseries}}% 見出しのスタイル % % %小々節の定義 \renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}% インデント {1.5\Cvs \@plus.5\Cvs \@minus.2\Cvs}% 見出しの前の縦空白 {.5\Cvs \@plus.3\Cvs}% 見出しの後の縦空白 {\reset@font\normalsize\bfseries}}% 見出しのスタイル % % %段落の定義 \renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}% インデント {3.25ex \@plus 1ex \@minus .2ex}% 見出しの前の縦空白 {-1em}% 見出しの後の縦空白(-が付いているので改行なし) {\reset@font\normalsize\bfseries}}% 見出しのスタイル % % %小段落の定義 \renewcommand{\subparagraph}{\@startsection{subparagraph}{5}{\z@}% インデント {3.25ex \@plus 1ex \@minus .2ex}% 見出しの前の縦空白 {-1em}% 見出しの後の縦空白(-が付いているので改行なし) {\reset@font\normalsize\bfseries}}% 見出しのスタイル % \makeatother 6 TEX 一覧へ . . comp -MYPEDIA TEX- 5.2 jreport の場合 jreport には章が加わります。章の定義は複雑でよくわからないので省きます。 jreport では、部は 1 ページ分取って見出しを出力します。 以下は、jreport の場合の見出しの指定部をすべてコピーして、少し手直ししたも のです。赤字の部分が指定する部分なので、説明を参考にして適宜修正、プリアン ブルに貼り付けておけばデザインが変えられます。 \makeatletter % % %部の定義 \renewcommand{\part}{% \if@openright \cleardoublepage \else \clearpage \fi \thispagestyle{empty}% \if@twocolumn\onecolumn\@tempswatrue\else\@tempswafalse\fi \null\vfil \secdef\@part\@spart} \def\@part[#1]#2{% \ifnum \c@secnumdepth >-2\relax \refstepcounter{part}% \addcontentsline{toc}{part}{% \prepartname\thepart\postpartname% \hspace{1em}#1}% 目次における第 I 部と見出し文の間の空白 \else \addcontentsline{toc}{part}{#1}% \fi \markboth{}{}% {\centering% 見出しの中央(\raggedright や\raggedleft でも可) \interlinepenalty\@M\reset@font \ifnum \c@secnumdepth >-2\relax \huge\bfseries\prepartname\thepart\postpartname% 第 I 部の部分のスタイル \par\vskip20\p@% 第 I 部と見出し文の間の空白 \fi \Huge\bfseries#2\par}% 見出し文の部分のスタイル \@endpart} \def\@spart#1{{% \centering% part*について中央寄せの指定 \interlinepenalty\@M\reset@font \Huge\bfseries#1\par}% part*について見出し文のスタイル \@endpart} \def\@endpart{\vfil\newpage \if@twoside\null\thispagestyle{empty}\newpage\fi \if@tempswa\twocolumn\fi} % % %章の定義 7 TEX 一覧へ . . comp -MYPEDIA TEX- \renewcommand{\chapter}{% \if@openright\cleardoublepage\else\clearpage\fi \thispagestyle{jpl@in}% \global\@topnum\z@ \@afterindenttrue \secdef\@chapter\@schapter} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne \refstepcounter{chapter}% \typeout{\@chapapp\space\thechapter\space\@chappos}% \addcontentsline{toc}{chapter}% {\protect\numberline{\@chapapp\thechapter\@chappos}#1}% \else \addcontentsline{toc}{chapter}{#1}% \fi \chaptermark{#1}% \addtocontents{lof}{\protect\addvspace{10\p@}}% \addtocontents{lot}{\protect\addvspace{10\p@}}% \@makechapterhead{#2}\@afterheading} \def\@makechapterhead#1{\hbox{}% \vskip2\Cvs% 見出しの上の縦空白 {\parindent\z@ \raggedright% 見出しの左寄せ(\centering や\raggedleft でも可) \reset@font\huge\bfseries% 章見出しのスタイル \leavevmode \ifnum \c@secnumdepth >\m@ne \setlength\@tempdima{\linewidth}% \setbox\z@\hbox{\@chapapp\thechapter\@chappos% \hskip1zw}% 第 1 章と見出し文の間の空白 \addtolength\@tempdima{-\wd\z@}% \unhbox\z@\nobreak \vtop{\hsize\@tempdima#1}% \else #1\relax \fi}\nobreak\vskip3\Cvs}% 見出しの下の縦空白 \def\@schapter#1{% \@makeschapterhead{#1}\@afterheading% } \def\@makeschapterhead#1{\hbox{}% \vskip2\Cvs% \chapter*についての見出しの上の縦空白 {\parindent\z@ \raggedright% \chapter*についての左寄せ指定 \reset@font\huge\bfseries% \chapter*についての見出しスタイル \leavevmode \setlength\@tempdima{\linewidth}% \vtop{\hsize\@tempdima#1}}\vskip3\Cvs}% \chapter*についての見出しの下の縦空白 % % %節の定義 8 TEX 一覧へ . . comp -MYPEDIA TEX- \renewcommand{\section}{\@startsection{section}{1}{\z@}% インデント {1.5\Cvs \@plus.5\Cvs \@minus.2\Cvs}% 見出しの前の縦空白 {.5\Cvs \@plus.3\Cvs}% 見出しの後の縦空白 {\reset@font\Large\bfseries}}% 見出しのスタイル % % %小節の定義 \renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}% インデント {1.5\Cvs \@plus.5\Cvs \@minus.2\Cvs}% 見出しの前の縦空白 {.5\Cvs \@plus.3\Cvs}% 見出しの後の縦空白 {\reset@font\large\bfseries}}% 見出しのスタイル % % %小々節の定義 \renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}% インデント {1.5\Cvs \@plus.5\Cvs \@minus.2\Cvs}% 見出しの前の縦空白 {.5\Cvs \@plus.3\Cvs}% 見出しの後の縦空白 {\reset@font\normalsize\bfseries}}% 見出しのスタイル % % %段落の定義 \renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}% インデント {3.25ex \@plus 1ex \@minus .2ex}% 見出しの前の縦空白 {-1em}% 見出しの後の縦空白(-が付いているので改行なし) {\reset@font\normalsize\bfseries}}% 見出しのスタイル % % %小段落の定義 \renewcommand{\subparagraph}{\@startsection{subparagraph}{5}{\z@}% インデント {3.25ex \@plus 1ex \@minus .2ex}% 見出しの前の縦空白 {-1em}% 見出しの後の縦空白(-が付いているので改行なし) {\reset@font\normalsize\bfseries}}% 見出しのスタイル % \makeatother 5.3 jbook の場合 jbook は jreport とほとんど同じですが、部と章の始めが奇数ページ(右ページ) に来るように設定されています。 以下は、jbook の場合の見出しの指定部をすべてコピーして、少し手直ししたも のです。赤字の部分が指定する部分なので、説明を参考にして適宜修正、プリアン ブルに貼り付けておけばデザインが変えられます。 \makeatletter % 9 TEX 一覧へ . . comp -MYPEDIA TEX- % %部の定義 \renewcommand{\part}{% \if@openright \cleardoublepage \else \clearpage \fi \thispagestyle{empty}% \if@twocolumn\onecolumn\@tempswatrue\else\@tempswafalse\fi \null\vfil \secdef\@part\@spart} \def\@part[#1]#2{% \ifnum \c@secnumdepth >-2\relax \refstepcounter{part}% \addcontentsline{toc}{part}{% \prepartname\thepart\postpartname% \hspace{1em}#1}% 目次における第 I 部と見出し文の間の空白 \else \addcontentsline{toc}{part}{#1}% \fi \markboth{}{}% {\centering% 見出しの中央(\raggedright や\raggedleft でも可) \interlinepenalty\@M\reset@font \ifnum \c@secnumdepth >-2\relax \huge\bfseries\prepartname\thepart\postpartname% 第 I 部の部分のスタイル \par\vskip20\p@% 第 I 部と見出し文の間の空白 \fi \Huge\bfseries#2\par}% 見出し文の部分のスタイル \@endpart} \def\@spart#1{{% \centering% part*について中央寄せの指定 \interlinepenalty\@M\reset@font \Huge\bfseries#1\par}% part*について見出し文のスタイル \@endpart} \def\@endpart{\vfil\newpage \if@twoside\null\thispagestyle{empty}\newpage\fi \if@tempswa\twocolumn\fi} % % %章の定義 \renewcommand{\chapter}{% \if@openright\cleardoublepage\else\clearpage\fi \thispagestyle{jpl@in}% \global\@topnum\z@ \@afterindenttrue \secdef\@chapter\@schapter} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter \refstepcounter{chapter}% \typeout{\@chapapp\space\thechapter\space\@chappos}% \addcontentsline{toc}{chapter}% 10 TEX 一覧へ . . comp -MYPEDIA TEX- {\protect\numberline{\@chapapp\thechapter\@chappos}#1}% \else\addcontentsline{toc}{chapter}{#1}\fi \else \addcontentsline{toc}{chapter}{#1}% \fi \chaptermark{#1}% \addtocontents{lof}{\protect\addvspace{10\p@}}% \addtocontents{lot}{\protect\addvspace{10\p@}}% \@makechapterhead{#2}\@afterheading} \def\@makechapterhead#1{\hbox{}% \vskip2\Cvs% 見出しの上の縦空白 {\parindent\z@ \raggedright% 見出しの左寄せ(\centering や\raggedleft でも可) \reset@font\huge\bfseries% 章見出しのスタイル \leavevmode \ifnum \c@secnumdepth >\m@ne \setlength\@tempdima{\linewidth}% \if@mainmatter \setbox\z@\hbox{\@chapapp\thechapter\@chappos% \hskip1zw}% 第 1 章と見出し文の間の空白 \addtolength\@tempdima{-\wd\z@}% \unhbox\z@\nobreak \fi \vtop{\hsize\@tempdima#1}% \else #1\relax \fi}\nobreak\vskip3\Cvs}% 見出しの下の縦空白 \def\@schapter#1{% \@makeschapterhead{#1}\@afterheading } \def\@makeschapterhead#1{\hbox{}% \vskip2\Cvs% \chapter*についての見出しの上の縦空白 {\parindent\z@ \raggedright% \chapter*についての左寄せ指定 \reset@font\huge\bfseries% \chapter*についての見出しスタイル \leavevmode \setlength\@tempdima{\linewidth}% \vtop{\hsize\@tempdima#1}}\vskip3\Cvs}% \chapter*についての見出しの下の縦空白 % % %節の定義 \renewcommand{\section}{\@startsection{section}{1}{\z@}% インデント {1.5\Cvs \@plus.5\Cvs \@minus.2\Cvs}% 見出しの前の縦空白 {.5\Cvs \@plus.3\Cvs}% 見出しの後の縦空白 {\reset@font\Large\bfseries}}% 見出しのスタイル % % %小節の定義 \renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}% インデント 11 TEX 一覧へ . . comp -MYPEDIA TEX- {1.5\Cvs \@plus.5\Cvs \@minus.2\Cvs}% 見出しの前の縦空白 {.5\Cvs \@plus.3\Cvs}% 見出しの後の縦空白 {\reset@font\large\bfseries}}% 見出しのスタイル % % %小々節の定義 \renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}% インデント {1.5\Cvs \@plus.5\Cvs \@minus.2\Cvs}% 見出しの前の縦空白 {.5\Cvs \@plus.3\Cvs}% 見出しの後の縦空白 {\reset@font\normalsize\bfseries}}% 見出しのスタイル % % %段落の定義 \renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}% インデント {3.25ex \@plus 1ex \@minus .2ex}% 見出しの前の縦空白 {-1em}% 見出しの後の縦空白(-が付いているので改行なし) {\reset@font\normalsize\bfseries}}% 見出しのスタイル % % %小段落の定義 \renewcommand{\subparagraph}{\@startsection{subparagraph}{5}{\z@}% インデント {3.25ex \@plus 1ex \@minus .2ex}% 見出しの前の縦空白 {-1em}% 見出しの後の縦空白(-が付いているので改行なし) {\reset@font\normalsize\bfseries}}% 見出しのスタイル % \makeatother 12 TEX 一覧へ . .