General ⇒ Document Title in Header
Document Title in Header
Hello,
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}
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}
NEW: TikZ book now 40% off at Amazon.com for a short time.

Document Title in Header
Hi EnWor,
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:
I took the liberty to change the original document class from article to scrartcl (from the KOMA-Script bundle). This is only a suggestion.
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}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Document Title in Header
Juhu, It works, thx ;)
But now i have another problem...
I used the \ihead command because in my document i put the section with:
... into the Header
With Markboth this doesn't work... :(
Any Solution?
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
Hi,
can you please describe exactly what information and in what positions should appear in your headers? That will save us time and effort.
can you please describe exactly what information and in what positions should appear in your headers? That will save us time and effort.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Re: Document Title in Header
oke... sry
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
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
Hi,
then you could use something like the following:
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}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
- Stefan Kottwitz
- Site Admin
- Posts: 10348
- Joined: Mon Mar 10, 2008 9:44 pm
Document Title in Header
Hi,
Stefan
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}
LaTeX.org admin
Re: Document Title in Header
Juhu
)
Thx you... It work's like I wished
Thank's a lot

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

Thank's a lot
Document Title in Header
Hi Stefan,
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}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
- Stefan Kottwitz
- Site Admin
- Posts: 10348
- Joined: Mon Mar 10, 2008 9:44 pm
Document Title in Header
Hi gmedina,
yes, I've compiled your code, instead of something the word title appeared in the output, arising from \@title.
Stefan
yes, I've compiled your code, instead of something the word title appeared in the output, arising from \@title.
Stefan
LaTeX.org admin