
私の文書は次のようになっています ( main.tex
)。
% Document type: report (master/bachelor thesis)
\documentclass[a4paper,12pt,appendix]{report}
\input{template/FormatsAndDefs.tex} % here I have specified various format settings
\begin{document}
\input{thesis.tex}
\end{document}
では、FormatsAndDefs.tex
章のタイトルの形式を次のように指定しています。
\usepackage[T1]{fontenc}
\usepackage{titlesec}
% various other packages
\titleformat{\chapter}
{\normalfont\Large\bfseries}{\thechapter}{.5em}{\vspace{.5ex}}[\titlerule]
\titlespacing*{\chapter}
{0pt}{0pt}{15pt}
したがって、私のタイトルの章は次のようにフォーマットされます。
この章のタイトル「Introducion」を、太字と下線を付けたまますべて大文字にするにはどうすればよいでしょうか。
私が使用しようとしたのは以下です\MakeUppercase
:
\titleformat{\chapter}
{\normalfont\LARGE\bfseries}{\MakeUppercase{\thechapter}}{.5em}{\vspace{.5ex}}[\titlerule]
しかし、章は写真に示されているとおり同じままでした。
答え1
章のタイトルを把握しておく必要があり、これを行う唯一の方法はexplicit
、titlesec
:
\documentclass{report}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}
\titleformat{\chapter}
{\normalfont\Large\bfseries}{\thechapter \quad \MakeUppercase{#1}}{.5em}{\vspace{.5ex}}[\titlerule]
\titlespacing*{\chapter}
{0pt}{0pt}{15pt}
\begin{document}
\chapter{Introduction}
\lipsum
\end{document}
このオプションを使用すると、explicit
セクションタイトルを として記述し#1
、 で囲むことができます\MakeUppercase
。
答え2
さまざまな部分に適切な場所を使用します。ルールの前のスペースは最後の引数 (オプションの引数) に配置する必要があるため、 などの 1 つのパラメータを持つマクロを使用してタイトル引数を終了することができます\MakeUppercase
。
\documentclass{report}
\usepackage{titlesec}
\usepackage{lipsum}
\titleformat{\chapter}
{\normalfont\Large\bfseries}
{\thechapter}
{.5em}
{\MakeUppercase}
[\vspace{.5ex}\titlerule]
\titlespacing*{\chapter}
{0pt}
{0pt}
{15pt}
\begin{document}
\chapter{Introduction}
\lipsum
\end{document}