![如何将章节标题大小写更改为 CHAPTER?](https://linux22.com/image/355717/%E5%A6%82%E4%BD%95%E5%B0%86%E7%AB%A0%E8%8A%82%E6%A0%87%E9%A2%98%E5%A4%A7%E5%B0%8F%E5%86%99%E6%9B%B4%E6%94%B9%E4%B8%BA%20CHAPTER%EF%BC%9F.png)
\documentclass[12pt, a4paper]{report}
\usepackage[left=3cm,top=3cm,right=2cm,bottom=2cm,bindingoffset=0.5cm]{geometry}
\usepackage{lipsum}
\usepackage{sectsty}
\usepackage{titlesec}
\renewcommand{\chaptername}{BAB}
\titleformat{\section}
{\normalfont\fontsize{16}{16}\bfseries}{\thesection}{1em}{}
\usepackage[utf8]{inputenc}
\usepackage[bahasai,english]{babel}
\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[linktocpage]{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\makeatletter
\def\@makechapterhead#1{%
%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \centering \normalfont
\ifnum \c@secnumdepth >\m@ne
\Large\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 0\p@
\fi
\interlinepenalty\@M
\LARGE \bfseries #1\par\nobreak
\vskip 30\p@
}}
\def\@makeschapterhead#1{%
%%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \centering
\normalfont
\interlinepenalty\@M
\LARGE \bfseries #1\par\nobreak
\vskip 30\p@
}}
\makeatother
我试过了,\renewcommand{\chaptername}{BAB}
没有变化(BAB 是印尼语中“章节”的意思)。谢谢
答案1
如果文档中的主要语言是印尼语,则应加载babel
为
\usepackage[english,bahasai]{babel}
这将使用“Bab”而不是“Chapter”。现在的问题是将名称排版为大写字母:\MakeUppercase{\@chapapp}
在重新定义的代码中使用\@makechapterhead
。
\documentclass[12pt, a4paper]{report}
\usepackage[
left=3cm,
top=3cm,
right=2cm,
bottom=2cm,
bindingoffset=0.5cm
]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[english,bahasai]{babel} % <---- main language last
\usepackage{lipsum}
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\fontsize{16}{16}\bfseries}
{\thesection}
{1em}
{}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[linktocpage]{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\makeatletter
\def\@makechapterhead#1{%
%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \centering \normalfont
\ifnum \c@secnumdepth >\m@ne
\Large\bfseries \MakeUppercase{\@chapapp}\space \thechapter % <--- uppercase
\par\nobreak
\vskip 0\p@
\fi
\interlinepenalty\@M
\LARGE \bfseries #1\par\nobreak
\vskip 30\p@
}}
\def\@makeschapterhead#1{%
%%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \centering
\normalfont
\interlinepenalty\@M
\LARGE \bfseries #1\par\nobreak
\vskip 30\p@
}}
\makeatother
\begin{document}
\chapter{Test}
\end{document}
不要同时加载sectsty
和titlesec
。
答案2
您可以看到我制作的一个简单示例,使章节标签变为大写。
\documentclass{book}
\usepackage{titlesec}
\titleformat{\chapter}
[display] %possible values are hang, leftmargin, drop, etc.
{\Huge} % format to be applied to the whole title
{\MakeUppercase{\chaptertitlename} \thechapter} %label setting
{0pt} %horizontal separation between label and title body
{\MakeUppercase} %code preceding the title body
\renewcommand{\chaptername}{BAB} %to change "chapter" into "bab"
\begin{document}
\chapter{Preface}
\section{Introduction}
\section{Preliminary}
\end{document}
我所说的一切都在titlesec
软件包文档中。Go这里有关格式化标题的其他解释。
答案3
\renewcommand{\chaptername}
请于之后放置\begin{document}
\documentclass[12pt, a4paper]{report}
\usepackage[left=3cm,top=3cm,right=2cm,bottom=2cm,bindingoffset=0.5cm]{geometry}
\usepackage{lipsum}
\usepackage{sectsty}
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\fontsize{16}{16}\bfseries}{\thesection}{1em}{}
\usepackage[utf8]{inputenc}
\usepackage[bahasai,english]{babel}
\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[linktocpage]{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\begin{document}
\makeatletter
\renewcommand{\chaptername}{BAB}
\def\@makechapterhead#1{%
%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \centering \normalfont
\ifnum \c@secnumdepth >\m@ne
\Large\bfseries \chaptername\space \thechapter
\par\nobreak
\vskip 0\p@
\fi
\interlinepenalty\@M
\LARGE \bfseries #1\par\nobreak
\vskip 30\p@
}}
\def\@makeschapterhead#1{%
%%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \centering
\normalfont
\interlinepenalty\@M
\LARGE \bfseries #1\par\nobreak
\vskip 30\p@
}}
\makeatother
\chapter{Test}
Trial
\end{document}