标题中的作者姓名未显示

标题中的作者姓名未显示

在这个 MWE 中,我没有在标题中找到作者的名字。

\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{txfonts}
\usepackage{mathdots}
\usepackage{lipsum}
\usepackage{bmpsize}
\usepackage[classicReIm]{kpfonts}
\usepackage{scrextend}
\usepackage{graphicx}
\usepackage[affil-it]{authblk}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{titling}

\setlength\headheight{20pt}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\textit{\thepage}}
\fancyhead[LO]{\textit{\nouppercase{\leftmark}}}

\renewcommand{\headrulewidth}{0.4pt}

% Custom command to set running head for odd and even pages
\newcommand{\oddhead}{\markright{Running Head}}

\begin{document}
    
    \title{Relative Advantage of Latex}
    \date{}
    \author{Rui de S. Cxx\thanks{Polytechnic of Porto: \texttt{[email protected]}}}
    
    \maketitle
    \thispagestyle{empty}
    
    \fancyhead[RE]{R.Camps} % Move this line after \author command
    
    \begin{small}
        \textbf{Abstract}
        \\  
        \noindent bla bla.
    \end{small}
    
    \newpage
    
    \section{Introduction}
    
    \textbf{1st paragraph}\\
    \lipsum[1]
    
    \textbf{2nd paragraph}\\
    \lipsum[2]
    \lipsum[2]
    \lipsum[3]
    \lipsum[3]
    
    \newpage
    \lipsum[5]
    \lipsum[6]
    \lipsum[7]
    
\end{document}

答案1

您的文档是单面的,因为这是类的默认设置article。因此您永远不会有左页。所有页面都是右页,称为奇怪的LaTeX 中的页面。因此您的

\fancyhead[LE]{R.Camps} % Move this line after \author command

定义一个(左对齐)页面头元素甚至页面,无法产生任何输出。可以将其替换为类似

\fancyhead[CO]{R.Camps} % Move this line after \author command

它将作者显示在页眉的中心奇怪的(因此所有)页面

\documentclass{article}
\usepackage[utf8]{inputenc}% Not needed any longer from LaTeX 2018/10/04.

%\usepackage{amssymb}% Not needed so show the problem or solution.
%\usepackage{amsmath}% Not needed so show the problem or solution.
%\usepackage{txfonts}% Not needed so show the problem or solution.
%\usepackage{mathdots}% Not needed so show the problem or solution.
\usepackage{lipsum}
%\usepackage{bmpsize}% Not needed so show the problem or solution.
%\usepackage[classicReIm]{kpfonts}% Not needed so show the problem or solution.
%\usepackage{scrextend}% Not needed so show the problem or solution.
%\usepackage{graphicx}% Not needed so show the problem or solution.
%\usepackage[affil-it]{authblk}% Not needed so show the problem or solution.
\usepackage{fancyhdr}
%\usepackage{hyperref}% Not needed so show the problem or solution.
%\usepackage{titling}% Not needed so show the problem or solution.

%\setlength\headheight{20pt}% Not needed so show the problem or solution.

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\textit{\thepage}}
\fancyhead[LO]{\textit{\nouppercase{\leftmark}}}

\renewcommand{\headrulewidth}{0.4pt}

% Custom command to set running head for odd and even pages
%\newcommand{\oddhead}{\markright{Running Head}}% Not needed so show the problem or solution.

\begin{document}
    
    \title{Relative Advantage of Latex}
    \date{}
    \author{Rui de S. Cxx\thanks{Polytechnic of Porto: \texttt{[email protected]}}}
    
    \maketitle
    \thispagestyle{empty}

    \fancyhead[CO]{R.Camps} % Move this line after \author command
    
    \begin{small}
        \textbf{Abstract}
        \\  
        \noindent bla bla.
    \end{small}
    
    \newpage
    
    \section{Introduction}
    
    \textbf{1st paragraph}\\
    \lipsum[1]
    
    \textbf{2nd paragraph}\\
    \lipsum[2]
    \lipsum[2]
    \lipsum[3]
    \lipsum[3]
    
    \newpage
    \lipsum[5]
    \lipsum[6]
    \lipsum[7]
    
\end{document}

第 2 页,作者位于头部中间

第 3 页,头部中间为作者

或更换

\documentclass{article}

经过

\documentclass[twoside]{article}

有双面文件,作者在左边(=甚至) 页:

\documentclass[twoside]{article}
% All preamble code not related to the problem removed
\usepackage{lipsum}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\textit{\thepage}}
\fancyhead[LO]{\textit{\nouppercase{\leftmark}}}

\renewcommand{\headrulewidth}{0.4pt}

\begin{document}
    
    \title{Relative Advantage of Latex}
    \date{}
    \author{Rui de S. Cxx\thanks{Polytechnic of Porto: \texttt{[email protected]}}}
    
    \maketitle
    \thispagestyle{empty}
    
    \fancyhead[RE]{R.Camps} % Move this line after \author command
    
    \begin{small}
        \textbf{Abstract}
        \\  
        \noindent bla bla.
    \end{small}
    
    \newpage
    
    \section{Introduction}
    
    \textbf{1st paragraph}\\
    \lipsum[1]
    
    \textbf{2nd paragraph}\\
    \lipsum[2]
    \lipsum[2]
    \lipsum[3]
    \lipsum[3]
    
    \newpage
    \lipsum[5]
    \lipsum[6]
    \lipsum[7]
    
\end{document}

第 2 页,作者位于头部右侧

第 3 页无作者

相关内容