Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am new with tex and hope that my question is clear and easy to answer.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{ \markboth{#1}{} }
\renewcommand{\subsectionmark}[1]{ \markright{#1}{} }

\begin{document}

    \section[O\lowercase{rganization of ma\uppercase{RNA}}]{maRNA%
    \sectionmark{O\lowercase{rganization of ma\uppercase{RNA}}}}

\end{document}

I need to add alternative section title in the header (provided in the []). However, besides alternative title section number goes their too.

Question: How can I add alternative title to the header, without adding section number?

--

Please understand that I am only starting with latex and my code might be illogical as it is compilation of things that work for me.

share|improve this question
    
What's the reason for \lowercase and \uppercase? You can easily change the header appearance with fancyhdr features (look for \nouppercase). It's not clear what \chaptermark should do in article. –  egreg May 24 at 13:03
    
Terms that I am using(eg., maRNA) have both lower an uppercase. I didn't know how to deal with it as header makes them all uppercase if I don't specify. –  Poe May 24 at 13:09
    
The main question is: why don't you want the number? If you have it for some sections, there should be for all. –  egreg May 24 at 13:12
    
Because for most of my document subsection titles goes into the header. Now there is page with new section starting in it and there is no subsection in that page, hence section title goes into the header. And I need to change its structure as it is not the same what was with subsections. –  Poe May 24 at 13:16

2 Answers 2

up vote 2 down vote accepted

My try:

\documentclass{article}

\usepackage{lipsum} % just for the example

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[R]{\nouppercase{\rightmark}}
\fancyfoot[C]{\thepage}

\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{\markright{#1}}


\begin{document}

\title{A title}
\author{A. Uthor}

\maketitle

\section{maRNA}

\subsection{Organization of maRNA}

\lipsum[1-12]

\subsection{Something else on maRNA}

\lipsum

\end{document}
share|improve this answer
    
Thanks it worked! Can you please explain \renewcommand{\sectionmark}[1]{}? –  Poe May 24 at 13:46
1  
@Poe Usually \sectionmark issues \markboth{<...>}{} so setting the \leftmark. By redefining it to do nothing, only the \rightmark will be set by \subsection. You can still have an empty header in the second page if no subsection starts in the first or second page, which is unlikely. –  egreg May 24 at 15:35
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}

\begin{document}

\section*{Organization of maRNA}
\markright{Organization of maRNA}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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