Document Classesinsert file name in the document (header, footer)

Information and discussion about specific document classes and how to create your own document classes.
Cherepan
Posts: 9
Joined: Mon Sep 08, 2008 10:00 pm

Re: insert file name in the document (header, footer)

Post by Cherepan »

Thanks a lot. That worked for \documentclass[a4paper,10pt]{report} :)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Cherepan
Posts: 9
Joined: Mon Sep 08, 2008 10:00 pm

insert file name in the document (header, footer)

Post by Cherepan »

Stefan_K wrote:Perhaps we can help if you show us the class file,
Well, here they are
Attachments
mwe_dissert.tex
tex
(316 Bytes) Downloaded 228 times
dissert.cls
cls
(18.27 KiB) Downloaded 231 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

insert file name in the document (header, footer)

Post by Stefan Kottwitz »

The dissert class redefines \ps@headings, that's causing it.
Using the internal macro \@oddhead too you could write into your preamble:

Code: Select all

\makeatletter
\def\@oddhead{\jobname\hfil\thepage}
\makeatother
and don't use \markboth, dissert.cls doesn't support that standard LaTeX macro.

Stefan
LaTeX.org admin
Cherepan
Posts: 9
Joined: Mon Sep 08, 2008 10:00 pm

Re: insert file name in the document (header, footer)

Post by Cherepan »

Amaizing! It worked! Thank you!
The second part of the question... how can I insert the file neme on the first page only? :roll:
User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

insert file name in the document (header, footer)

Post by Stefan Kottwitz »

Similar, after the first page, after \newpage:

Code: Select all

\makeatletter
\renewcommand*\@oddhead{\hfil\thepage}
\makeatother
Stefan
LaTeX.org admin
Cherepan
Posts: 9
Joined: Mon Sep 08, 2008 10:00 pm

Re: insert file name in the document (header, footer)

Post by Cherepan »

Thanks a lot!
By the way, what does it mean * before \@oddhead ?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

insert file name in the document (header, footer)

Post by Stefan Kottwitz »

The star marks a "short command", that means a parameter cannot span over more than one paragraph, it cannot contain \par. This makes it easier to find possible errors, that's why I prefer the starred form when I know the parameter cannot contain paragraph breaks, I'm used to it. See also Short and Long Commands.

Stefan
LaTeX.org admin
firebush
Posts: 4
Joined: Fri Oct 31, 2008 3:31 pm

Re: insert file name in the document (header, footer)

Post by firebush »

Thanks! \jobname works great. I couldn't find this anywhere else.
Brian
Post Reply