1

I am writing a thesis and using MasterDoctrolThesis.cls format. This format shows the chapter name and heading of the current page in the header. I want to add Chinese specific character on each page of my thesis. The code of MasterDoctrolThesis.cls for header is:

\RequirePackage[markcase=used]{scrlayer-scrpage}
\providepairofpagestyles{thesisSimple}{%
    \clearpairofpagestyles%
    \automark[chapter]{chapter}
    \ihead{\headmark}% Inner header
    \ohead[\pagemark]{\pagemark}% Outer header
}
\ifoot{}% Inner footer
\ofoot{}% Outer footer
\pagestyle{thesisSimple}
\providepairofpagestyles[thesisSimple]{thesis}{%
    \automark*[section]{}%
}
\providepairofpagestyles[thesisSimple]{review}{%
    \ofoot[\shorttitle/\authorname]{\shorttitle/\authorname}
    \ifoot[\today]{\today}
}
\pagestyle{thesis}
\ifbool{headsepline}{\KOMAoption{headsepline}{true}}{}
\PreventPackageFromLoading[\ClassError{\classname}{Package `fancyhdr' is
incompatible\MessageBreak with this class}{The pagesyles are defined 
    using package `scrlayer-scrpage', please consult the\MessageBreak 
KOMA-script documentation for details.}]{fancyhdr}


\newcommand{\blank@p@gestyle}{empty}
\newcommand{\chapter@p@gestyle}{plain}
\NewDocumentCommand{\blankpagestyle}{ m }{%
    \ClassWarning{\classname}{\string\blankpagestyle\space is
    obsolete,\MessageBreak use \string\setblankpagestyle \space  instead}\renewcommand{\blank@p@gestyle}{}{#1}
}
\NewDocumentCommand{\setblankpagestyle}{ m }{\renewcommand{\blank@p@gestyle}{#1}}
\NewDocumentCommand{\setchapterpagestyle}{ m }{\renewcommand{\chapter@p@gestyle}{#1}}

\DeclareDocumentCommand\cleardoublepage{}{\clearpage\if@twoside \ifodd\c@page\else
    \hbox{}
    \thispagestyle{\blank@p@gestyle}
    \newpage
    \if@twocolumn\hbox{}\newpage\fi\fi\fi%
}

I need to add the follwing characters given in the picture in my header. enter image description here

and need to put just red line in footer like: enter image description here

For this the following code I have used, but it could not work:

\pagestyle{fancy} % all pages will follow same fancy header and footer style except title page
\fancyhf{} % Clear header and footer
\fancyhead[C]
{\begin{CJK*}{UTF8}{gkai}
        \fontsize{20}{20} \textbf{华\hspace{0.5cm}中\hspace{0.5cm}科\hspace{0.5cm}技\hspace{0.5cm}大\hspace{0.5cm}学\hspace{0.5cm}研\hspace{0.5cm}究\hspace{0.5cm}生\hspace{0.5cm}院} \end{CJK*}}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.7pt} % Line at the header visible

How should I do this? Please help me out to this problem?

  • If you want to use the CJK* environment, it appears that you may want to add the command \usepackage{CJKutf8}. Another option is XeCJK. – Davislor May 23 at 0:18
  • Do not change the class file. – Johannes_B May 23 at 4:19
  • \clearpairofpagestyles\cfoot*{\pagemark}\chead{\textbf{华\hspace{0.5cm}中\hspace{0.5cm}科\hspace{0.5cm}技\hspace{0.5cm}大\hspace{0.5cm}学\hspace{0.5cm}研\hspace{0.5cm}究\hspace{0.5cm}生\hspace{0.5cm}院} (And the stuff to get the chinese working) – Johannes_B May 23 at 4:24
  • @Johannes_B This code is showing error: ` ! Paragraph ended before \@@chead was complete.<to be read again>\par ` – Nafees Ahmed May 23 at 7:12
1

Add footsepline to the global options.

headsepline, % Uncomment to get a line under the header
footsepline,% <-------
%chapterinoneline, % Uncomment to place the chapter title next to the number on one line
%consistentlayout, % Uncomment to change the layout of the declaration, abstract and acknowledgements pages to match the default layout
]{MastersDoctoralThesis} % The class file specifying the document structure

%\usepackage[utf8]{inputenc} % Required for inputting international characters
%\usepackage[T1]{fontenc} % Output font encoding for international characters

%\usepackage{mathpazo} % Use the Palatino font by default
\usepackage{fontspec}
\setmainfont{Noto Serif CJK}
\clearpairofpagestyles
\cfoot*{\pagemark}
\chead{华\hspace{0.5cm}中\hspace{0.5cm}科\hspace{0.5cm}技\hspace{0.5cm}大\hspace{0.5cm}学\hspace{0.5cm}研\hspace{0.5cm}究\hspace{0.5cm}生\hspace{0.5cm}院}
\setkomafont{pagehead}{\normalfont\bfseries}
\addtokomafont{pageheadfoot}{\color{red!80!black}}

On my very old installation, LuaTeX refuses to find the bold font weights. I won't did deeper into this, as the issue is most likely gone with a fresh installation of TeX Live, or the solution for TL17 would be obsolete.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.