TeX - LaTeX Asked by wbook on April 13, 2021
I’m writing an essay of which content should be showed in Chinese and English. The Chinese content is showed perfect as the main language, but the English content cannot show the ‘Chapter’ at the beginning of each title of chapter.
Mine(wrong)
Only Chapter needs this, while Section or subsection do not need this.
In my main page:
begin{document}
pagenumbering{Roman}setcounter{page}{1}
tableofcontents
maketableofcontents %Chinese
tableofengcontents %English
cleardoublepage
end{document}
In the definition of content page:
%—————————English Contents—————————————
makeatletter
newcommandengcontentsname{Contents}
newcommandtableofengcontents{%
if@twocolumn
@restonecoltrueonecolumn
else
@restonecolfalse
fi
chapter*{engcontentsname
@mkboth{%
MakeUppercaseengcontentsname}{MakeUppercaseengcontentsname}}%
@starttoc{toe}% !!!!Define a new contents!!!!
if@restonecoltwocolumnfi
}
newcommandaddengcontents[2]{%
addcontentsline{toe}{#1}{protectnumberline{csname the#1endcsname}#2}}
makeatother
newcommandechapter[1]{addengcontents{chapter}{#1}}
newcommandesection[1]{addengcontents{section}{#1}}
newcommandesubsection[1]{addengcontents{subsection}{#1}}
newcommandesubsubsection[1]{addengcontents{subsubsection}{#1}}
%—————————English Contents—————————————
I suppose the ‘Chapter’ should be inserted in the somewhere above?
If anyone could help me.
Thanks very much!!
The tocloft
package can help, read the documentation (texdoc tocloft
).
After the end of your English Contents
add
usepackage{tocloft}
renewcommand{cftchappresnum}{Chapter } % put Chapter before number
addtolength{cftchapnumwidth}{4em} % Extra space for Chapter
This worked with my rendering of your code into an MWE (shown below) which of course didn't process maketableofcontents
as you had shown no code for that. I have no idea about your Chinese chapter titles if they will be affected.
% engchintocprob.tex SE 539522
documentclass{report}
%—————————English Contents—————————————
makeatletter
newcommandengcontentsname{Contents}
newcommandtableofengcontents{%
if@twocolumn
@restonecoltrueonecolumn
else
@restonecolfalse
fi
chapter*{engcontentsname
@mkboth{%
MakeUppercaseengcontentsname}{MakeUppercaseengcontentsname}}%
@starttoc{toe}% !!!!Define a new contents!!!!
if@restonecoltwocolumnfi
}
newcommandaddengcontents[2]{%
addcontentsline{toe}{#1}{protectnumberline{csname the#1endcsname}#2}}
makeatother
newcommandechapter[1]{addengcontents{chapter}{#1}}
newcommandesection[1]{addengcontents{section}{#1}}
newcommandesubsection[1]{addengcontents{subsection}{#1}}
newcommandesubsubsection[1]{addengcontents{subsubsection}{#1}}
%—————————English Contents—————————————
usepackage{tocloft}
renewcommand{cftchappresnum}{Chapter }
addtolength{cftchapnumwidth}{4em}
begin{document}
pagenumbering{Roman}setcounter{page}{1}
tableofcontents
maketableofcontents %Chinese
tableofengcontents %English
cleardoublepage
echapter{First}
end{document}
Answered by Peter Wilson on April 13, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP