1

I will try to set the short running title using xkeyval package. But I don't how to execute this coding using the xkeyval option

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

Kindly advice how to execute the coding [shorttitle={Cross-linked aromatic polymers}]

MWE

\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} 

My output and mentioned my requirement

enter image description here

  • 1
    Off topic: you can use \lipsum[1-20], for example, to print 20 blocks of dummy text. – Sigur Feb 20 '15 at 19:02
  • I can't understand... what do you say?.. It needs to update my MWE – Vetri Feb 20 '15 at 19:32
  • 1
    I'm just informing you that instead of using a lot of commands you can use only one. – Sigur Feb 20 '15 at 19:36
  • Your document does not compile. It complains about an unknown command \titlemark. – user31729 Feb 20 '15 at 22:22
1

Here's one possibility, using keyval to handle the key:

\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}

An image of the resulting header:

enter image description here

If you don't use the optional argument for \title (i.e., no short title is given), then the full title name is used as the \rightmark. If this is not desired, change

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

to

\def\@@title#1{\def\authormark{#1}\@@@title{#1}}
  • @medina i got the solution. Your solution is really good. Thank You... – Vetri Feb 21 '15 at 3:55

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.