bug fix for newtx pkg update

This commit is contained in:
EthanDeng
2022-03-07 17:04:26 +08:00
parent 909fb2c997
commit 6a60b16e14
3 changed files with 159 additions and 88 deletions

View File

@@ -344,16 +344,17 @@
\RequirePackage{makecell,lipsum,hologo}
%%
%%
\RequirePackage[center,pagestyles]{titlesec}
\RequirePackage[title,titletoc,header]{appendix}
\RequirePackage[
backend=biber,
citestyle=\ELEGANT@citestyle,
bibstyle=\ELEGANT@bibstyle]{biblatex}
%%
\RequirePackage{appendix}
\defbibheading{elegantbook}[\ebibname]{#1}
\ifdefstring{\ELEGANT@lang}{cn}{
\renewcommand{\baselinestretch}{1.3}
@@ -365,13 +366,12 @@
\renewcommand{\listfigurename}{}
\renewcommand{\listtablename}{}
\renewcommand{\bibname}{}
\newcommand{\ebibname}{}
\renewcommand{\appendixname}{}
\renewcommand{\appendixtocname}{}
\renewcommand{\indexname}{\hspace{2em}}
\newcommand\figref[1]{\textbf{}~\ref{#1}}
\newcommand\tabref[1]{\textbf{}~\ref{#1}}
\ifdefstring{\ELEGANT@scheme}{chinese}{
\renewcommand{\chaptername}{\zhnumber{\arabic{chapter}}}}{
\renewcommand{\chaptername}{ \thechapter{} }}
\newcommand{\authorname}{\citshape }
\newcommand{\institutename}{\citshape }
\newcommand{\datename}{\citshape }
@@ -398,12 +398,16 @@
\newcommand\bioinfo[2]{\gdef\@bioinfo{{\citshape #1}#2}}
\newcommand{\updatename}{}
\newcommand{\historyname}{}
}{\relax}
\newcommand{\beforechap}{}
\newcommand{\afterchap}{}
}{\relax}
\ifdefstring{\ELEGANT@lang}{en}{
\setlength\parindent{2em}
\newcommand\figref[1]{\textbf{Figure}~\ref{#1}}
\newcommand\tabref[1]{\textbf{Table}~\ref{#1}}
\renewcommand{\chaptername}{Chapter \thechapter}
\renewcommand{\chaptername}{Chapter}
\renewcommand{\partname}{\color{structurecolor} Part}
\newcommand{\authorname}{\textbf{Author: }}
\newcommand{\institutename}{\textbf{Institute: }}
@@ -428,6 +432,7 @@
\newcommand{\propertyname}{Property}
\newcommand{\introductionname}{Introduction}
\renewcommand{\appendixname}{Appendix}
\newcommand{\ebibname}{Bibliography}
% \newcommand{\problemsetname}{Exercise}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Updates:}
@@ -441,7 +446,7 @@
\setlength\parindent{2em}
\newcommand\figref[1]{\textbf{Figura}~\ref{#1}}
\newcommand\tabref[1]{\textbf{Tabella}~\ref{#1}}
\renewcommand{\chaptername}{Chapter \thechapter}
\renewcommand{\chaptername}{Chapter}
\newcommand{\authorname}{\textbf{Autore: }}
\newcommand{\institutename}{\textbf{Istituto: }}
\newcommand{\datename}{\textbf{Data: }}
@@ -466,6 +471,7 @@
\newcommand{\introductionname}{Introduzione}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Aggiornamenti:}
\newcommand{\ebibname}{Bibliografia}
\newcommand{\historyname}{Cronologia delle versioni}
}{\relax}
@@ -476,7 +482,7 @@
\setlength\parindent{2em}
\renewcommand\figref[1]{\textbf{Figure}\ref{#1}}
\renewcommand\tabref[1]{\textbf{Tableau}\ref{#1}}
\renewcommand{\chaptername}{Chapitre \thechapter}
\renewcommand{\chaptername}{Chapitre}
\renewcommand{\authorname}{\textbf{Auteur: }}
\renewcommand{\institutename}{\textbf{Institut: }}
\renewcommand{\datename}{\textbf{Date: }}
@@ -501,6 +507,7 @@
\renewcommand{\introductionname}{Introduction}
\renewcommand{\problemsetname}{Exercice}
\renewcommand{\updatename}{Mises à jour:}
\newcommand{\ebibname}{Bibliographie}
\renewcommand{\historyname}{Historique des versions}
}{\relax}
@@ -510,7 +517,7 @@
\setlength\parindent{2em}
\newcommand\figref[1]{\textbf{Figuur}~\ref{#1}}
\newcommand\tabref[1]{\textbf{Tabel}~\ref{#1}}
\renewcommand{\chaptername}{Hoofdstuk \arabic{chapter}}
\renewcommand{\chaptername}{Hoofdstuk}
\newcommand{\authorname}{\textbf{Auteur: }}
\newcommand{\institutename}{\textbf{Instituut: }}
\newcommand{\datename}{\textbf{Datum: }}
@@ -536,6 +543,7 @@
\newcommand{\problemsetname}{Probleemcomplex}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Update:}
\newcommand{\ebibname}{Bibliographie}
\newcommand{\historyname}{Versie Geschiedenis}
}{\relax}
@@ -545,7 +553,7 @@
\setlength\parindent{2em}
\newcommand\figref[1]{\ref{#1}~\textbf{Ábra}}
\newcommand\tabref[1]{\ref{#1}~\textbf{Táblázat}}
\renewcommand{\chaptername}{\thechapter ~ fejezet}
\renewcommand{\chaptername}{Fejezet}
\newcommand{\authorname}{\textbf{Szerző: }}
\newcommand{\institutename}{\textbf{Intézmény: }}
\newcommand{\datename}{\textbf{Dátum: }}
@@ -571,6 +579,7 @@
\newcommand{\problemsetname}{Feladatok}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Frissítve:}
\newcommand{\ebibname}{Bibliográfia}
\newcommand{\historyname}{Korábbi verziók}
}{\relax}
@@ -584,7 +593,7 @@
\renewcommand{\listtablename}{Tabellenverzeichnis}
\renewcommand{\bibname}{Bibliographie}
\renewcommand{\appendixname}{Anhang}
\renewcommand{\chaptername}{Kapitel \thechapter}
\renewcommand{\chaptername}{Kapitel}
\newcommand{\authorname}{\textbf{Autor: }}
\newcommand{\institutename}{\textbf{Institut: }}
\newcommand{\datename}{\textbf{Datum: }}
@@ -610,6 +619,7 @@
\newcommand{\introductionname}{Einleitung}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Updates:}
\renewcommand{\ebibname}{Bibliographie}
\newcommand{\historyname}{Version der Geschichte}
}{\relax}
@@ -618,7 +628,7 @@
\setlength\parindent{2em}
\newcommand\figref[1]{\textbf{Figura}~\ref{#1}}
\newcommand\tabref[1]{\textbf{Tabla}~\ref{#1}}
\renewcommand{\spanishchaptername}{Capítulo \thechapter}
\renewcommand{\spanishchaptername}{Capítulo}
\newcommand{\authorname}{\textbf{Autor: }}
\newcommand{\institutename}{\textbf{Instituto: }}
\newcommand{\datename}{\textbf{Fecha: }}
@@ -644,6 +654,7 @@
\newcommand{\problemsetname}{Ejercicio}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Actualización:}
\newcommand{\ebibname}{Bibliografía}
\newcommand{\historyname}{Historial de versiones}
}{\relax}
@@ -654,7 +665,7 @@
\setlength\parindent{2em}
\newcommand\figref[1]{\textbf{Зураг}\ref{#1}}
\newcommand\tabref[1]{\textbf{Хүснэгт}\ref{#1}}
\renewcommand{\chaptername}{Бүлэг \thechapter}
\renewcommand{\chaptername}{Бүлэг}
\newcommand{\authorname}{\textbf{Зохиогч: }}
\newcommand{\institutename}{\textbf{Сургууль: }}
\newcommand{\datename}{\textbf{Огноо: }}
@@ -680,15 +691,17 @@
\newcommand{\problemsetname}{Бодлогууд}
\newcommand\bioinfo[2]{\gdef@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Шинэчлэлтүүд:}
\newcommand{\ebibname}{Ном зүй}
\newcommand{\historyname}{Хувилбарын түүх}
}{\relax}
\ifdefstring{\ELEGANT@lang}{pt}{
\RequirePackage[portuguese]{babel}
\setlength\parindent{2em}
\newcommand\figref[1]{\textbf{Figura}~\ref{#1}}
\newcommand\tabref[1]{\textbf{Tabela}~\ref{#1}}
\renewcommand{\spanishchaptername}{Capítulo \thechapter}
\renewcommand{\chaptername}{Capítulo}
\newcommand{\authorname}{\textbf{Autor: }}
\newcommand{\institutename}{\textbf{Instituição: }}
\newcommand{\datename}{\textbf{Data: }}
@@ -714,9 +727,53 @@
\newcommand{\problemsetname}{Questão}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Atualização: }
\newcommand{\ebibname}{Bibliografia}
\newcommand{\historyname}{Histórico de versões}
}{\relax}
\ifdefstring{\ELEGANT@lang}{jp}{
\RequirePackage{luatexja}
\setlength\parindent{2em}
\renewcommand{\contentsname}{}
\newcommand\figref[1]{\textbf{}~\ref{#1}}
\newcommand\tabref[1]{\textbf{}~\ref{#1}}
\renewcommand{\partname}{\color{structurecolor}}
\renewcommand{\listfigurename}{}
\renewcommand{\listtablename}{}
\renewcommand{\bibname}{}
\renewcommand{\appendixname}{}
\renewcommand{\chaptername}{ \thechapter }
\newcommand{\authorname}{\textbf{}}
\newcommand{\institutename}{\textbf{}}
\newcommand{\datename}{\textbf{}}
\newcommand{\versionname}{\textbf{\citshape }}
\newcommand{\notename}{}
\newcommand{\proofname}{}
\newcommand{\problemname}{}
\newcommand{\definitionname}{}
\newcommand{\theoremname}{}
\newcommand{\axiomname}{}
\newcommand{\postulatename}{}
\newcommand{\lemmaname}{}
\newcommand{\propositionname}{}
\newcommand{\corollaryname}{}
\newcommand{\examplename}{}
\newcommand{\instancename}{}
\newcommand{\exercisename}{}
\newcommand{\remarkname}{}
\newcommand{\assumptionname}{}
\newcommand{\conclusionname}{}
\newcommand{\solutionname}{}
\newcommand{\propertyname}{}
\newcommand{\introductionname}{}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{}
\newcommand{\ebibname}{}
\newcommand{\historyname}{}
}{\relax}
\graphicspath{{./figure/}{./figures/}{./image/}{./images/}{./graphics/}{./graphic/}{./pictures/}{./picture/}}
\RequirePackage{tikz} %% load tikz without tikz
@@ -736,12 +793,19 @@
\setlist[itemize,2]{label={\eitemii}}
\setlist[itemize,3]{label={\eitemiii}}
\RequirePackage[center,pagestyles]{titlesec}
\RequirePackage{apptools}
% appendix chapter:
\ifdefstring{\ELEGANT@lang}{cn}{
\ifdefstring{\ELEGANT@scheme}{chinese}{
\newcommand{\xchaptertitle}{\zhnumber{\arabic{chapter}}} }{
\newcommand{\xchaptertitle}{ \thechapter{} }} }{
\newcommand{\xchaptertitle}{\chaptername~\thechapter~}}
\setcounter{secnumdepth}{5}
\titleformat{\chapter}[\style]{\bfseries}{
\filcenter\LARGE\enspace\bfseries{\color{structurecolor} \IfAppendix{\appendixname\;\thechapter}{\chaptername}\;}}{1pt}{
\filcenter\LARGE\enspace\bfseries{\color{structurecolor} \IfAppendix{\appendixname\;\thechapter\;}{\xchaptertitle\;}}}{1pt}{
\LARGE\bfseries\color{structurecolor}\filcenter}[]
\titleformat{\section}[hang]{\bfseries}{
\Large\bfseries{\color{structurecolor}\thesection}\enspace}{1pt}{%
@@ -959,9 +1023,9 @@
\RequirePackage{adforn}
\newenvironment{problemset}[1][\chaptername~\;\exercisename]{
\newenvironment{problemset}[1][\xchaptertitle~\exercisename]{
\begin{center}
\phantomsection\addcontentsline{toc}{section}{\texorpdfstring{\chaptername\;\exercisename}{\exercisename}}
\phantomsection\addcontentsline{toc}{section}{\texorpdfstring{\xchaptertitle~\exercisename}{\exercisename}}
% \markboth{#1}{\rightmark}
\markright{#1}
\textcolor{structurecolor}{\Large\bfseries\adftripleflourishleft~#1~\adftripleflourishright}
@@ -986,7 +1050,7 @@
\fancyhf{}
\fancyfoot[c]{\color{structurecolor}\scriptsize\thepage}
\fancyfoot[c]{\color{structurecolor}\small\thepage}
\if@twoside
\fancyhead[EL]{\color{structurecolor}\cnormal\leftmark}
\fancyhead[OR]{\color{structurecolor}\cnormal\rightmark}
@@ -1000,8 +1064,7 @@
% \renewcommand{\headrule}{}
\fancypagestyle{plain}{\renewcommand{\headrulewidth}{0pt}\fancyhf{}\renewcommand{\headrule}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\, #1}{}}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\, #1}{}}
\renewcommand{\chaptermark}[1]{\markboth{\xchaptertitle\, #1}{}}
\renewcommand*{\maketitle}{%
@@ -1163,3 +1226,30 @@
\thispagestyle{empty}%
\newpage%
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
% https://tex.stackexchange.com/questions/56839/chaptername-is-used-even-for-appendix-chapters-in-toc
\usepackage{calc}
\usepackage[titles]{tocloft}
\ifdefstring{\ELEGANT@lang}{cn}{
\renewcommand{\cftchappresnum}{\beforechap\space}
\renewcommand{\cftchapaftersnum}{\space\afterchap}
\setlength{\cftchapnumwidth}{\widthof{\textbf{~999}}}
\g@addto@macro\appendix{%
\addtocontents{toc}{%
\protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}%
\protect\renewcommand{\protect\cftchapaftersnum}{}%
}%
}
}{
\renewcommand{\cftchappresnum}{\chaptername\space}
\renewcommand{\cftchapaftersnum}{\space}
\setlength{\cftchapnumwidth}{\widthof{\textbf{Appendix~9}}}
\g@addto@macro\appendix{%
\addtocontents{toc}{%
\protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}%
\protect\renewcommand{\protect\cftchapaftersnum}{}%
\setlength{\cftchapnumwidth}{\widthof{\textbf{Appendix~999}}}
}%
}
}