fix problemset header problem

This commit is contained in:
EthanDeng
2020-08-04 22:25:03 +08:00
parent 4e53474e6e
commit 01951eeb28
3 changed files with 42 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
\documentclass[cn,11pt]{elegantbook} \documentclass[cn,10pt]{elegantbook}
\title{ElegantBook优美的 \LaTeX{} 书籍模板} \title{ElegantBook优美的 \LaTeX{} 书籍模板}
\subtitle{Elegant\LaTeX{} 经典之作} \subtitle{Elegant\LaTeX{} 经典之作}

View File

@@ -1,4 +1,4 @@
\documentclass[11pt,fancy,twocol]{elegantbook} \documentclass[11pt,fancy,twocol,twoside]{elegantbook}
\title{An Elegant \LaTeX{} Template for Books} \title{An Elegant \LaTeX{} Template for Books}
\subtitle{Classic Elegant\LaTeX{} Template} \subtitle{Classic Elegant\LaTeX{} Template}
@@ -13,6 +13,8 @@
\logo{logo-blue.png} \logo{logo-blue.png}
\cover{cover.jpg} \cover{cover.jpg}
\usepackage{imakeidx}
\makeindex
\usepackage[symbols,nogroupskip,sort=none]{glossaries-extra} \usepackage[symbols,nogroupskip,sort=none]{glossaries-extra}
@@ -33,7 +35,7 @@
\mainmatter \mainmatter
\printunsrtglossary[type=symbols,style=long] \printunsrtglossary[type=symbols,style=long]
\part{HELLO WORLD}
\chapter{Elegant\LaTeX{} Templates} \chapter{Elegant\LaTeX{} Templates}
Elegant\LaTeX{} Program developers are intended to provide you beautiful, elegant, user-friendly templates. Currently, the Elegant\LaTeX{} is composed of \href{https://github.com/ElegantLaTeX/ElegantNote}{ElegantNote}, \href{https://github.com/ElegantLaTeX/ElegantBook}{ElegantBook}, \href{https://github.com/ElegantLaTeX/ElegantPaper}{ElegantPaper}, designed for typesetting notes, books, and working papers respectively. Latest releases are strongly recommended! This guide is aimed at briefly introducing the 101 of this template. For any other question, suggestion or comment, feel free to contact us on GitHub \href{https://github.com/ElegantLaTeX/ElegantBook/issues}{issues} or email us at \email{elegantlatex2e@gmail.com}. $\gls{F}$ Elegant\LaTeX{} Program developers are intended to provide you beautiful, elegant, user-friendly templates. Currently, the Elegant\LaTeX{} is composed of \href{https://github.com/ElegantLaTeX/ElegantNote}{ElegantNote}, \href{https://github.com/ElegantLaTeX/ElegantBook}{ElegantBook}, \href{https://github.com/ElegantLaTeX/ElegantPaper}{ElegantPaper}, designed for typesetting notes, books, and working papers respectively. Latest releases are strongly recommended! This guide is aimed at briefly introducing the 101 of this template. For any other question, suggestion or comment, feel free to contact us on GitHub \href{https://github.com/ElegantLaTeX/ElegantBook/issues}{issues} or email us at \email{elegantlatex2e@gmail.com}. $\gls{F}$
@@ -186,7 +188,7 @@ BTW, we provide Certificate of Donation for those who donated, tippers please le
\includegraphics[width=0.7\textwidth]{cert.pdf} \includegraphics[width=0.7\textwidth]{cert.pdf}
\end{figure} \end{figure}
\part{HELLO WORLD}
This template is based on the Standard \LaTeX{} book class, so the options of book class work as well (Note that the option of papersize has no effect due to \lstinline{device} option). The default encoding is UTF-8 while \TeX{} Live is recommended. The test environment is Win10 + \TeX{} Live 2019, either \hologo{pdfLaTeX} or \lstinline{XeLaTeX} works fine. \lstinline{XeLaTeX} is preferred for Chinese articles. This template is based on the Standard \LaTeX{} book class, so the options of book class work as well (Note that the option of papersize has no effect due to \lstinline{device} option). The default encoding is UTF-8 while \TeX{} Live is recommended. The test environment is Win10 + \TeX{} Live 2019, either \hologo{pdfLaTeX} or \lstinline{XeLaTeX} works fine. \lstinline{XeLaTeX} is preferred for Chinese articles.
@@ -482,7 +484,7 @@ You can change the title of this environment by modifying the optional argument
\end{introduction} \end{introduction}
\end{lstlisting} \end{lstlisting}
\section{Problem Set} %\section{Problem Set}
The environment \lstinline{problemset} is used at the end of each chapter to display corresponding exercises. Just type in the following sentences: The environment \lstinline{problemset} is used at the end of each chapter to display corresponding exercises. Just type in the following sentences:
\begin{lstlisting} \begin{lstlisting}
\begin{problemset} \begin{problemset}
@@ -658,6 +660,10 @@ Regression analysis is a powerful statistical method that allows you to examine
Let's continue using our application training example. In this case, we'd want to measure the historical levels of satisfaction with the events from the past three years or so, as well as any information possible in regards to the independent variables. Let's continue using our application training example. In this case, we'd want to measure the historical levels of satisfaction with the events from the past three years or so, as well as any information possible in regards to the independent variables.
\section{Second section}
This second section\index{S!section} may include some special word,
and expand the ones already used\index{keywords!used}.
\begin{table}[htbp] \begin{table}[htbp]
\small \small
@@ -693,6 +699,7 @@ Let's continue using our application training example. In this case, we'd want t
\item Distributed storage and search. \item Distributed storage and search.
\end{itemize} \end{itemize}
%\problemset
\begin{problemset} \begin{problemset}
\item Solve the equation $5(- 3x - 2) - (x - 3) = -4(4x + 5) + 13$. \item Solve the equation $5(- 3x - 2) - (x - 3) = -4(4x + 5) + 13$.
\item Find the distance between the points $(-4 , -5)$ and $(-1 , -1)$. \item Find the distance between the points $(-4 , -5)$ and $(-1 , -1)$.
@@ -776,4 +783,6 @@ This appendix covers some of the basic mathematics used in econometrics. We brie
\sum_{i=1}^n x_i \equiv x_1 + x_2 +\cdots + x_n \sum_{i=1}^n x_i \equiv x_1 + x_2 +\cdots + x_n
\end{equation} \end{equation}
\printindex
\end{document} \end{document}

View File

@@ -109,6 +109,7 @@
\geometry{ \geometry{
a4paper, a4paper,
top=25.4mm, bottom=25.4mm, top=25.4mm, bottom=25.4mm,
left=20mm, right=20mm,
headheight=2.17cm, headheight=2.17cm,
headsep=4mm, headsep=4mm,
footskip=12mm footskip=12mm
@@ -136,6 +137,7 @@
}{\relax} }{\relax}
\setcounter{tocdepth}{1} \setcounter{tocdepth}{1}
\renewcommand{\baselinestretch}{1.2}
\PassOptionsToPackage{no-math}{fontspec} \PassOptionsToPackage{no-math}{fontspec}
\RequirePackage{iftex} \RequirePackage{iftex}
@@ -338,10 +340,6 @@
%%
\linespread{1.3}
\RequirePackage{graphicx} \RequirePackage{graphicx}
%\RequirePackage{enumerate} %\RequirePackage{enumerate}
\RequirePackage{amsmath,mathrsfs,amsfonts,amssymb} \RequirePackage{amsmath,mathrsfs,amsfonts,amssymb}
@@ -366,6 +364,7 @@
} }
\ifdefstring{\ELEGANT@lang}{cn}{ \ifdefstring{\ELEGANT@lang}{cn}{
\renewcommand{\baselinestretch}{1.3}
\renewcommand{\contentsname}{} \renewcommand{\contentsname}{}
\renewcommand{\figurename}{} \renewcommand{\figurename}{}
\renewcommand{\tablename}{} \renewcommand{\tablename}{}
@@ -387,7 +386,6 @@
\newcommand{\versionname}{\citshape } \newcommand{\versionname}{\citshape }
\newcommand{\notename}{} \newcommand{\notename}{}
\renewcommand*{\proofname}{} \renewcommand*{\proofname}{}
\newcommand{\problemname}{}
\newcommand{\definitionname}{} \newcommand{\definitionname}{}
\newcommand{\theoremname}{} \newcommand{\theoremname}{}
\newcommand{\axiomname}{} \newcommand{\axiomname}{}
@@ -395,15 +393,16 @@
\newcommand{\lemmaname}{} \newcommand{\lemmaname}{}
\newcommand{\propositionname}{} \newcommand{\propositionname}{}
\newcommand{\corollaryname}{} \newcommand{\corollaryname}{}
\newcommand{\examplename}{} \newcommand{\examplename}{} %
\newcommand{\exercisename}{} \newcommand{\instancename}{} %
\newcommand{\problemname}{} %
\newcommand{\exercisename}{} % =
\newcommand{\remarkname}{} \newcommand{\remarkname}{}
\newcommand{\assumptionname}{} \newcommand{\assumptionname}{}
\newcommand{\conclusionname}{} \newcommand{\conclusionname}{}
\newcommand{\solutionname}{} \newcommand{\solutionname}{}
\newcommand{\propertyname}{} \newcommand{\propertyname}{}
\newcommand{\introductionname}{} \newcommand{\introductionname}{}
\newcommand{\problemsetname}{}
\newcommand\bioinfo[2]{\gdef\@bioinfo{{\citshape #1}#2}} \newcommand\bioinfo[2]{\gdef\@bioinfo{{\citshape #1}#2}}
\newcommand{\updatename}{} \newcommand{\updatename}{}
\newcommand{\historyname}{} \newcommand{\historyname}{}
@@ -434,7 +433,7 @@
\newcommand{\solutionname}{Solution} \newcommand{\solutionname}{Solution}
\newcommand{\propertyname}{Property} \newcommand{\propertyname}{Property}
\newcommand{\introductionname}{Introduction} \newcommand{\introductionname}{Introduction}
\newcommand{\problemsetname}{Exercise} % \newcommand{\problemsetname}{Exercise}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}} \newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Updates:} \newcommand{\updatename}{Updates:}
\newcommand{\historyname}{Version History} \newcommand{\historyname}{Version History}
@@ -447,7 +446,6 @@
\setlength\parindent{2em} \setlength\parindent{2em}
\newcommand\figref[1]{\textbf{Figura}~\ref{#1}} \newcommand\figref[1]{\textbf{Figura}~\ref{#1}}
\newcommand\tabref[1]{\textbf{Tabella}~\ref{#1}} \newcommand\tabref[1]{\textbf{Tabella}~\ref{#1}}
% \renewcommand{\chaptername}{Capitolo \thechapter}
\newcommand{\authorname}{\textbf{Autore: }} \newcommand{\authorname}{\textbf{Autore: }}
\newcommand{\institutename}{\textbf{Istituto: }} \newcommand{\institutename}{\textbf{Istituto: }}
\newcommand{\datename}{\textbf{Data: }} \newcommand{\datename}{\textbf{Data: }}
@@ -470,7 +468,6 @@
\newcommand{\solutionname}{Soluzione} \newcommand{\solutionname}{Soluzione}
\newcommand{\propertyname}{Proprietà} \newcommand{\propertyname}{Proprietà}
\newcommand{\introductionname}{Introduzione} \newcommand{\introductionname}{Introduzione}
\newcommand{\problemsetname}{Esercizio}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}} \newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Aggiornamenti:} \newcommand{\updatename}{Aggiornamenti:}
\newcommand{\historyname}{Cronologia delle versioni} \newcommand{\historyname}{Cronologia delle versioni}
@@ -720,9 +717,12 @@
\end{tcolorbox}} \end{tcolorbox}}
\RequirePackage{adforn} \RequirePackage{adforn}
\newenvironment{problemset}[1][\chaptername~\chapterextra\problemsetname]{
\newenvironment{problemset}[1][\chaptername~\chapterextra\exercisename]{
\begin{center} \begin{center}
\phantomsection\addcontentsline{toc}{section}{\texorpdfstring{\chaptername\;\problemsetname}{\problemsetname}} \phantomsection\addcontentsline{toc}{section}{\texorpdfstring{\chaptername\;\exercisename}{\exercisename}}
% \markboth{#1}{\rightmark}
\markright{#1}
\textcolor{structurecolor}{\Large\bfseries\adftripleflourishleft~#1~\adftripleflourishright} \textcolor{structurecolor}{\Large\bfseries\adftripleflourishleft~#1~\adftripleflourishright}
\end{center} \end{center}
\begin{enumerate}}{ \begin{enumerate}}{
@@ -759,9 +759,9 @@
% \renewcommand{\headrule}{} % \renewcommand{\headrule}{}
\fancypagestyle{plain}{\renewcommand{\headrulewidth}{0pt}\fancyhf{}\renewcommand{\headrule}{}} \fancypagestyle{plain}{\renewcommand{\headrulewidth}{0pt}\fancyhf{}\renewcommand{\headrule}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\, #1}{} } \renewcommand{\sectionmark}[1]{\markright{\thesection\, #1}{} }
\renewcommand{\chaptermark}[1]{\markboth{\chaptername \, #1\,}{}} \renewcommand{\chaptermark}[1]{\markboth{\chaptername~\chapterextra{}#1}{}}
\renewcommand{\baselinestretch}{1.35}
\renewcommand*{\maketitle}{% \renewcommand*{\maketitle}{%
\hypersetup{pageanchor=false} \hypersetup{pageanchor=false}
@@ -871,8 +871,9 @@
% add the list of change history % add the list of change history
\newcommand{\dateinfoline}[2]{ \newcommand{\dateinfoline}[2]{
\noindent\makebox[0pt][r]{% \noindent\makebox[0pt][r]{%
\makebox[-5em][r]{% \makebox[-3em][r]{%
\textbf{\textcolor{structurecolor}{#1}}}\quad}% \small
\textbf{\textcolor{structurecolor}{#1}}}\;\;}%
{\citshape\updatename\ignorespaces#2}} {\citshape\updatename\ignorespaces#2}}
\newcommand{\datechange}[2]{% \newcommand{\datechange}[2]{%
@@ -920,7 +921,7 @@
\labelformat{algorithm}{~#1} \labelformat{algorithm}{~#1}
\labelformat{exercise}{~#1} \labelformat{exercise}{~#1}
\RequirePackage{pagecolor} \RequirePackage{pagecolor,afterpage}
\def\@part[#1]#2{% \def\@part[#1]#2{%
\newcommand*{\mylmargin}{\dimexpr\oddsidemargin+1in\relax} \newcommand*{\mylmargin}{\dimexpr\oddsidemargin+1in\relax}
\ifnum \c@secnumdepth >-2\relax \ifnum \c@secnumdepth >-2\relax
@@ -928,11 +929,10 @@
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
\else \else
\addcontentsline{toc}{part}{#1}% \addcontentsline{toc}{part}{#1}%
\fi \fi%
\markboth{}{}%
{ {
\centering \centering
\newpagecolor{structurecolor!10} \newpagecolor{structurecolor!10}\afterpage{\restorepagecolor}
\interlinepenalty \@M \interlinepenalty \@M
\normalfont \normalfont
\vskip 30\p@ \vskip 30\p@
@@ -947,7 +947,11 @@
\Huge\scshape\bfseries \textcolor{structurecolor}{\thepart.\; #2} \Huge\scshape\bfseries \textcolor{structurecolor}{\thepart.\; #2}
\vspace*{0.7\baselineskip}} \vspace*{0.7\baselineskip}}
\end{minipage}}} \end{minipage}}}
\@endpart \@endpart}
\restorepagecolor}
\renewcommand*{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}%
\thispagestyle{empty}%
\newpage%
\if@twocolumn\hbox{}\newpage\fi\fi\fi}