General ⇒ Document Title in Header
Document Title in Header
How can i insert the Author or Title into the Header?
In my solution I have to write the Name of the Author two times... how can i insert the \author name into the Header?
Greetings
EnWor
\documentclass[12pt,a4paper,twoside]{article}
\usepackage[automark,headsepline,plainheadsepline]{scrpage2}
\newcommand{\TheAuthor}{}
\newcommand{\Author}[1]{\renewcommand{\TheAuthor}{#1}}
\ihead{\TheAuthor}
\pagestyle{scrheadings}
\title{something}
\Author{Mustermann}
\author{Mustermann}
\begin{document}
\maketitle
\thispagestyle{empty}
\pagebreak
blabla
\end{document}
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Document Title in Header
you could use \markboth or \markright (some information about these commands can be found here), toghether with \@author (for the author) and \@title (for the title), as the following example suggests:
Code: Select all
\documentclass[12pt,a4paper,twoside]{scrartcl}
\usepackage[headsepline,plainheadsepline]{scrpage2}
\title{something}
\author{Mustermann}
\makeatletter
\markboth{\@title}{\@author}
\makeatother
\pagestyle{scrheadings}
\begin{document}
\maketitle
\thispagestyle{empty}
\newpage
blabla
\newpage
blabla
\end{document}
Document Title in Header
But now i have another problem...
I used the \ihead command because in my document i put the section with:
Code: Select all
\automark[section]{section}
\ohead[\headmark]{\headmark}
With Markboth this doesn't work... :(
Any Solution?
Re: Document Title in Header
can you please describe exactly what information and in what positions should appear in your headers? That will save us time and effort.
Re: Document Title in Header
In my twoside document I wand in the inner header the documenttitle, in the outer Header the sectiontitle and in the outer footer the page Number...
I hope this is exact enough... if not ask me..
so long
thanks a lot
EnWor
Document Title in Header
then you could use something like the following:
Code: Select all
\documentclass[12pt,a4paper,twoside]{scrartcl}
\usepackage[headsepline,plainheadsepline]{scrpage2}
\usepackage{lipsum}%just to generate some text
\title{something}
\author{Mustermann}
\automark[section]{section}
\ihead{\@title}
\pagestyle{scrheadings}
\begin{document}
\maketitle
\thispagestyle{empty}
\section{First section}
\lipsum[1-30]
\section{Second section}
\lipsum[1-30]
\end{document}
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Document Title in Header
this will not work like expected. This code should to it:gmedina wrote:Code: Select all
\ihead{\@title}
Code: Select all
\newcommand*\mytitle{something}
\title{\mytitle}
\ihead{\mytitle}
Re: Document Title in Header

Thx you... It work's like I wished

Thank's a lot
Document Title in Header
Did you compile the complete code I posted? It works OK (at least it does on my system). Maybe I misunderstand your comment, but what do you mean when you say that "it will not work as expected"?Stefan_K wrote:Hi,
this will not work like expected...gmedina wrote:Code: Select all
\ihead{\@title}
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Document Title in Header
yes, I've compiled your code, instead of something the word title appeared in the output, arising from \@title.
Stefan