\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}