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 '19 at 00:18
  • See: https://tex.stackexchange.com/questions/107898/type-chinese-in-tex-compiled-with-latex – Davislor May 23 '19 at 00:18
  • Do not change the class file. – Johannes_B May 23 '19 at 04: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 '19 at 04:24
  • @Johannes_B This code is showing error: ! Paragraph ended before \@@chead was complete.<to be read again>\par – Nafees Ahmed May 23 '19 at 07:12
  • Is there any way to change some code in MasterDoctoralThesis.cls header code mentioned in the question? – Nafees Ahmed May 23 '19 at 07:16
  • @Johannes_B I am looking forward to you? please give me a response? – Nafees Ahmed May 23 '19 at 16:51
  • I haven't been on my desk for over twelve hours and i won't br at it for maybe a day. You have to be patient. – Johannes_B May 23 '19 at 18:32
  • @Johannes_B okay, please. I am waiting – Nafees Ahmed May 23 '19 at 20:58
  • So the error you have been reporting for the code snippet i gave you earlier is due to one missing brace that closes the chead command. I didn't test the snippet (obviously), but the error message and an editor with code highlighting and brace matching should have made it obvious. – Johannes_B May 25 '19 at 05:27
  • Is there any news here? – Johannes_B May 27 '19 at 05:28

1 Answers1

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.

Johannes_B
  • 24,235
  • 10
  • 93
  • 248