
私はLaTeX初心者です。章や節の見出しの色を変えようとしましたが、一番簡単な方法はこれここで
\usepackage{xcolor}
\usepackage{sectsty}
\chapterfont{\color{blue}} % sets colour of chapters
\sectionfont{\color{cyan}} % sets colour of sections
問題なく動作しますが、
\chapter{Materials and Methods}
\section{Study Site}
作成した
2。材料と方法
2.1 研究サイト。
今は
2。材料と方法 <- スペースがありません
2.1 研究サイト。
この問題を修正する方法、またはすべての章とセクションの色を変更するより良い方法をご存知の方はいらっしゃいますか? さらに必要なコードがある場合はお知らせください。
今後ともよろしくお願いいたします!
私の短い例: (目的がわからないパッケージはすべて保管しています)
\documentclass[%
english,ngerman,%
BCOR=6mm,cdgeometry=no,%
DIV=13,cdfont=true
]{tudscrreprt}
\usepackage{booktabs}
\usepackage{siunitx}
% Packages for text:
\usepackage{sectsty} % to change the headings
\usepackage{xcolor}
\chapterfont{\color{TUDblue}} % sets colour of chapters
\sectionfont{\color{TUDblue2}} % sets colour of sections
\ifpdftex{
\usepackage[T1]{fontenc}
\usepackage[ngerman=ngerman-x-latest]{hyphsubst}
}{
\usepackage{fontspec}
}
\usepackage[UKenglish]{babel}
% Colors:
\definecolor{TUDblue}{RGB}{0,48,94}
\definecolor{TUDblue2}{RGB}{0,106,179}
\begin{document}
\tableofcontents % Here is still space
\chapter{Introduction} % Here not anymore
\section{Experimental design}
\subsection{What am I doing?}
\end{document}
答え1
ダルムシュタット工科大学 (TUD) が提供するドキュメントクラスを使用していると思います。私の記憶では、これらのドキュメントクラスは KOMA スクリプトに基づいています。
これらのクラスをインストールする代わりに、documentclass を scrreprt に変更しました。
KOMA スクリプトでは見出しの色を簡単に変更できますが、sectsty ではうまく動作しません。texdoc scrguien
コマンド ラインに入力すると、マニュアル全体が表示されます。
とはいえ、コードに 2 行追加し、他の行をコメント アウトしただけです。
\documentclass[%
english,ngerman,%
BCOR=6mm,cdgeometry=no,%
DIV=13,%cdfont=true
]{scrreprt}
\usepackage{booktabs}
\usepackage{siunitx}
% Packages for text:
%\usepackage{sectsty} % to change the headings
\usepackage{xcolor}
%\chapterfont{\color{TUDblue}} % sets colour of chapters
%\sectionfont{\color{TUDblue2}} % sets colour of sections
\ifpdftex{
\usepackage[T1]{fontenc}
\usepackage[ngerman=ngerman-x-latest]{hyphsubst}
}{
\usepackage{fontspec}
}
\usepackage[UKenglish]{babel}
%%%% Color with KOMAscript in sections
\addtokomafont{chapter}{\color{blue}}
\addtokomafont{section}{\color{cyan}}
% Colors:
%\definecolor{TUDblue}{RGB}{0,48,94}
%\definecolor{TUDblue2}{RGB}{0,106,179}
\begin{document}
\tableofcontents % Here is still space
\chapter{Introduction} % Here not anymore
\section{Experimental design}
\subsection{What am I doing?}
\end{document}
色を調整してください。TUD の色をシステムで使用可能な色に置き換える必要がありました。