
저는 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에서 제공하는 documentclass를 사용하고 계신 것으로 추측됩니다. 내가 기억하는 한, 해당 문서 클래스는 KOMA 스크립트를 기반으로 합니다.
해당 클래스를 설치하는 대신 documentclass를 scrprt로 변경했습니다.
KOMA 스크립트를 사용하면 제목 색상을 쉽게 변경할 수 있지만 sectsty에서는 잘 작동하지 않습니다. texdoc scrguien
명령줄에 입력하면 전체 매뉴얼을 얻을 수 있습니다 .
즉, 방금 코드에 두 줄을 추가하고 다른 줄을 주석 처리했습니다.
\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 색상을 시스템에서 사용 가능한 색상으로 바꿔야 했습니다.