How to get part name in LaTeX ?
Putting the part title into the header is not common, therefore there are no default macros for this.
You could redefine the \part
macro to save its argument to e.g. a \parttitle
macro which then can be used in the custom defined headers:
\newcommand*\parttitle{}
\let\origpart\part
\renewcommand*{\part}[2][]{%
\ifx\\#1\\% optional argument not present?
\origpart{#2}%
\renewcommand*\parttitle{#2}%
\else
\origpart[#1]{#2}%
\renewcommand*\parttitle{#1}%
\fi
}
That would depend on what type of "part" you are refering to, \chaptername
, \sectionname
, \thepage
, \thesection
, \thechapter
, etc... See this link for details.
EDIT: In light of your comment, this thread seems to be discussing a solution (note: there is a typo, it must be \renewcommand{\part}...
, i.e. a backslash must be added):
For using the parts, you can do the following:
\let\Oldpart\part \newcommand{\parttitle}{} \renewcommand{part}[1]{\Oldpart{#1}\renewcommand{\parttitle}{#1}}
and then use \parttitle in the header.
Another alternative is to use the
titlesec
package which provides commands like\partmark
that you can use.
In the KOMA-classes \part
executes a \partmark
command which you could use to set either \rightmark
or \leftmark
to the part title.
But as \part
always generates a new page and you probably need the header only on the next page you can also do something simple like this:
\newcommand\partcontent{}
...
\part{Blub}
\renewcommand\partcontent{Blub}
and then use \partcontent
in the header.