我想将 ToC、LoF 和 LoT 上的标题改为大写。
我指的是这个可能重复的问题。
我正在尝试添加:
\usepackage{etoolbox}
\patchcmd{\tableofcontents}{\contentsname}{\MakeUppercase\contentsname}{}{}
\patchcmd{\listoffigures}{\figurename}{\MakeUppercase\figurename}{}{}
\patchcmd{\listoftables}{\tablename}{\MakeUppercase\tablename}{}{}
它适用于 ToC(标题大写),但不适用于 LoF 和 LoT。你能帮助我吗?
我的 MWE:
\documentclass[a4paper,12pt,oneside,openany]{book}
\usepackage{pgf, tikz}
\usepackage[a4paper, inner=4cm, outer=3cm, top=4cm, bottom=3cm]{geometry}
\usepackage{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage[titles]{tocloft}
\usepackage{tocbibind}
\usepackage{indentfirst}
\usepackage{blindtext}
\usepackage{tocloft}
\usepackage{etoolbox}
\usepackage{enumitem}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage[column=O]{cellspace}
\usepackage{caption}
\usepackage{afterpage}
\usepackage{mathtools}
\usepackage{subcaption}
\usepackage{wrapfig}
\usepackage{cancel}
\usepackage{longtable}
\usepackage[indonesian]{babel}
\usepackage{lipsum}
\usepackage{pdflscape}
\usepackage{makecell}
\usepackage{ragged2e}
\newlist{ColEnum}{enumerate}{1}
\setlist[ColEnum,1]{label = \arabic*), left = 0pt, nosep,
before= {\begin{minipage}[t]{\hsize}\RaggedRight},
after = {\end{minipage}}}
\usetikzlibrary{arrows.meta,
chains,
matrix,
positioning,
quotes,
shapes.geometric}
\tikzset{FlowChart/.style = {
base/.style = {draw, minimum width=32mm, minimum height=8mm,
align=center},
startstop/.style = {base, ellipse},
process/.style = {base, rectangle},
io/.style = {base, trapezium, trapezium stretches,
trapezium left angle=70, trapezium right angle=110,
fill=blue!30},
decision/.style = {base, diamond, aspect=1.3, inner xsep=1pt},
arr/.style = {-Stealth, semithick}
}
}
\DeclareMathOperator{\Res}{Res}
\numberwithin{equation}{section}
\setlength{\cellspacetoplimit}{5pt}
\setlength{\cellspacebottomlimit}{4pt}
\theoremstyle{plain}
\newtheorem{thm}{Teorema}[section]
\newtheorem{cl}{Corollary}[section]
\newtheorem{lm}{Lemma}[section]
\theoremstyle{definition}
\newtheorem{defn}{Definisi}[section]
\newtheorem{exmp}{Contoh}
\renewcommand{\proofname}{\rm\bf{Bukti}}
\renewcommand\tablename{Tabel}
\renewcommand\figurename{Gambar}
\patchcmd{\section}{\bfseries}{\bfseries\boldmath}{}{}
\patchcmd{\tableofcontents}{\contentsname}{\MakeUppercase\contentsname}{}{}
\patchcmd{\listoffigures}{\figurename}{\MakeUppercase\figurename}{}{}
\patchcmd{\listoftables}{\tablename}{\MakeUppercase\tablename}{}{}
\setlength{\cftbeforesecskip}{10pt}
\setlength{\cftbeforesubsecskip}{10pt}
\fancyhf{}
\cfoot{\thepage}
\linespread{1.5}
\pagestyle{plain}
\renewcommand\cftchapdotsep{\cftdotsep}
\titleformat{\chapter}[block]
{\normalfont\bfseries\centering}
{}{0pt}{}
\titleformat{\section}
{\normalfont\bfseries}
{\thesection}{1em}{}
\titleformat{\subsection}
{\normalfont\bfseries}
{\thesubsection}{1em}{}
\titlespacing*{\chapter}{0pt}{0pt}{20pt}
\titlespacing*{\section}{0pt}{0pt}{0pt}
\titlespacing*{\subsection}{0pt}{0pt}{0pt}
\renewcommand{\contentsname}{DAFTAR ISI}
\renewcommand{\listtablename}{DAFTAR TABEL}
\renewcommand{\listfigurename}{DAFTAR GAMBAR}
\newcommand\dd{\mathop{}\!\mathrm{d}}
%\addtocontents{toc}{\protect\null\protect\hfill{Halaman}\protect\par}
\setlength\parindent{1.25cm}
\addtocontents{toc}{~\hfill{Halaman}\par}
\addtocontents{lot}{~\hfill{Halaman}\par}
\addtocontents{lof}{~\hfill{Halaman}\par}
\makeatletter
\def\ttl@mkchap@i#1#2#3#4#5#6#7{%
\ttl@assign\@tempskipa#3\relax\beforetitleunit
\vspace{\@tempskipa}%<<<<<< REMOVE THE * AFTER \vspace
\global\@afterindenttrue
\ifcase#5 \global\@afterindentfalse\fi
\ttl@assign\@tempskipb#4\relax\aftertitleunit
\ttl@topmode{\@tempskipb}{%
\ttl@select{#6}{#1}{#2}{#7}}%
\ttl@finmarks % Outside the box!
\@ifundefined{ttlp@#6}{}{\ttlp@write{#6}}}
\makeatother
\begin{document}
\clearpage
\thispagestyle{empty}
\frontmatter %
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
%\renewcommand{\arraystretch}{2.0}
\begin{spacing}{0.1}
\tableofcontents
\end{spacing}
\begin{spacing}{1.5}
\listoffigures
\listoftables
\end{spacing}
\mainmatter
\pagestyle{fancyplain}
\fancyhf{}
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\backmatter
\end{document}
抱歉,我不得不添加不必要的代码,因为我只是从我的原创作品中复制了它。一如既往,谢谢!
答案1
两件事情:
图表列表和表格列表的名称分别为\listfigurename
和\listtablename
。
为什么不直接重新定义这些?例如\renewcommand{\listfigurename}{LIST OF FIGURES}
?啊,我看你确实这么做了。那么出了什么问题?经过一番调查发现,\listfigurename
尽管你进行了重新定义,但已经将自身重置为非大写版本。事实证明,该babel
包很聪明,重置了值,\begin{document}
因此事实证明,使用\patchcmd
更正后的宏替换即可完成工作。(此外,所有其他重新定义类似内容的尝试
\renewcommand\tablename{Tabel}
\renewcommand\figurename{Gambar}
都是徒劳的(尽管babel
无论如何都应该按照您选择的方式设置这些值。