使用 xkeyval 选项的简短运行标题

使用 xkeyval 选项的简短运行标题

我将尝试使用包设置简短的运行标题xkeyval。但我不知道如何使用选项执行此xkeyval编码

\title[shorttitle={Cross-linked aromatic polymers}]{Stabilized sulfonated aromatic polymers by \textit{in~situ} solvothermal cross-linking}

请指教如何执行编码[shorttitle={Cross-linked aromatic polymers}]

平均能量损失

\documentclass[twocolumn]{article}

\usepackage{lipsum}


\makeatletter
\long\def\title{\@ifnextchar[{\short@title}{\@@title}}
\def\short@title[#1]{\titlemark{#1}\@@@title}
\def\@@title#1{\authormark{#1}\@@@title{#1}}
\long\def\@@@title#1{\gdef\@title{#1}}

\def\@authorrunning{}
\def\authorrunning#1{%
     \gdef\@authorrunning{#1}}

\def\ps@allpage{%
\def\@evenhead{%
\vbox{\vskip6.5pt%
\hbox to\textwidth{{\@authorrunning}\hfill{\rightmark}\strut}\vskip4.7pt
{\hrule width\textwidth height0.25pt}
}
}%
\def\@evenfoot{}%
\def\@oddfoot{}
\def\@oddhead{%
\vbox{\vskip6.5pt%
\hbox to\textwidth{{\@authorrunning}\hfill{\rightmark}\strut}\vskip4.7pt
{\hrule width\textwidth height0.25pt}
}
    \let\@mkboth\@gobbletwo
%    \let\sectionmark\@gobble
%    \let\subsectionmark\@gobble
    }
  \def\titlemark##1{\gdef\rightmark{##1}}%
  \def\authormark##1{\gdef\leftmark{##1}}%
    }

\makeatother

\begin{document}

\authorrunning{Author et~al.}

\title[shorttitle={Cross-linked aromatic polymers}]{Stabilized sulfonated aromatic polymers by \textit{in~situ} solvothermal cross-linking}

\maketitle

\pagestyle{allpage}

\section{Two}\label{s2}
\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]
\lipsum[5]
\lipsum[6]
\lipsum[7]


\section{Three}\label{s3}
\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]
\lipsum[5]
\lipsum[6]
\lipsum[7]
\lipsum[8]
\lipsum[9]
\lipsum[10]
\lipsum[11]
\lipsum[12]
\lipsum[13]
\lipsum[14]
\lipsum[15]
\lipsum[16]
\lipsum[17]
\lipsum[18]
\lipsum[19]


\end{document} 

我的输出并提到了我的要求

在此处输入图片描述

答案1

这是一种可能性,用来keyval处理密钥:

\documentclass[twocolumn]{article}
\usepackage{keyval}
\usepackage{lipsum}

\def\titlemark#1{}
\def\authormark#1{}

\makeatletter
\define@key{ShortTitleKey}{shorttitle}{\markright{#1}}
\long\def\title{\@ifnextchar[{\short@title}{\@@title}}
\def\short@title[#1]{{\setkeys{ShortTitleKey}{#1}}\@@@title}
\def\@@title#1{\markright{#1}\def\authormark{#1}\@@@title{#1}}
\long\def\@@@title#1{\gdef\@title{#1}}

\def\@authorrunning{}
\def\authorrunning#1{%
     \gdef\@authorrunning{#1}}

\def\ps@allpage{%
\def\@evenhead{%
\vbox{\vskip6.5pt%
\hbox to\textwidth{{\@authorrunning}\hfill{\rightmark}\strut}\vskip4.7pt
{\hrule width\textwidth height0.25pt}
}
}%
\def\@evenfoot{}%
\def\@oddfoot{}
\def\@oddhead{%
\vbox{\vskip6.5pt%
\hbox to\textwidth{{\@authorrunning}\hfill{\rightmark}\strut}\vskip4.7pt
{\hrule width\textwidth height0.25pt}
}
    \let\@mkboth\@gobbletwo
%    \let\sectionmark\@gobble
%    \let\subsectionmark\@gobble
    }
  \def\titlemark##1{\gdef\rightmark{##1}}%
  \def\authormark##1{\gdef\leftmark{##1}}%
    }

\makeatother

\begin{document}

\authorrunning{Author et~al.}

\title[shorttitle={Cross-linked aromatic polymers}]{Stabilized sulfonated aromatic polymers by \textit{in~situ} solvothermal cross-linking}
\maketitle

\pagestyle{allpage}

\section{Two}\label{s2}
\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]
\lipsum[5]
\lipsum[6]
\lipsum[7]


\section{Three}\label{s3}
\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]
\lipsum[5]
\lipsum[6]
\lipsum[7]
\lipsum[8]
\lipsum[9]
\lipsum[10]
\lipsum[11]
\lipsum[12]
\lipsum[13]
\lipsum[14]
\lipsum[15]
\lipsum[16]
\lipsum[17]
\lipsum[18]
\lipsum[19]


\end{document}

生成的标题的图像:

在此处输入图片描述

如果您不使用可选参数\title(即未提供简称),则将使用完整标题名称作为\rightmark。如果不希望这样,请更改

\def\@@title#1{\markright{#1}\def\authormark{#1}\@@@title{#1}}

\def\@@title#1{\def\authormark{#1}\@@@title{#1}}

相关内容