0

I want to create a footer on all pages except the first.

After I had failed I tried with creating the same footer as on the first page and it still looks different.

It seems to only show a footer at all when I add \pagestyle{myheadings}

\documentclass{scrlttr2}

\renewcommand\familydefault{\sfdefault} \usepackage{tgheros}

\setkomavar{firstfoot}{\hrulefill\% \footnotesize \usekomavar{subject} \hfill \usekomavar{fromname}% }

\setkomavar{nextfoot}{\usekomavar{firstfoot}}

\pagestyle{myheadings}

\usepackage{Blindtext}

\begin{document} \begin{letter}{recipient} \setkomavar{subject}{Evaluation\ student}

    \opening{Hello}

    \Blindtext

\end{letter}

\end{document}

What am I doing wrong?

P.S.: Just to be sure: I only dsiplay the firstfoot to see if my definition was right and to show that the display is different between firstfoot and nextfoot even though they are identical...

mrCarnivore
  • 1,505
  • 6
    you should not use fancyhdr. KOMA has its own handling of pagestyle and it would only get (more) confusing if you load an additional package. – Ulrike Fischer Apr 23 '23 at 14:49
  • @UlrikeFischer: Thank you for the tipp. How should I handle the pagestyle with KOMA then? And why is firstfootand nextfoot not identical in my example? – mrCarnivore Apr 23 '23 at 14:51
  • 1
    Start to study the koma documentation (and no, I do not think that one can find out what is exactly going on in a few minutes). – Ulrike Fischer Apr 23 '23 at 14:53
  • 1
    If I wanted the first page footer to be different, I would create a new pagestyole and use \thispagestyle{...} on the first page. – John Kormylo Apr 23 '23 at 21:01
  • @JohnKormylo: My problem is that I do not get the nextfoot to display what I want. I only added firstfoot to show what nextfoot should look like... – mrCarnivore Apr 23 '23 at 21:08
  • 3
    I have already referred you several times to the KOMA-Script manuals and especially the KOMA-Script wiki. Why don't you read it? In this case: How to use scrlayer-scrpage to output the same header and footer in the same position on all pages of a letter. Again the same page is also available in German. Maybe you do not like the wiki or the manual. In this case, see the similar questions here. – cabohah Apr 24 '23 at 06:33
  • @cabohah: Thank you for your help. I did look at that question before posting mine and also looked into the wiki and even own the book for KOMA-Script. However, when using my definition for the footer it breaks... So the title of my question might seem more generic than the problem itself. Also my problem (as stated in the question and in a previous comment) is not that I want the same footer on every page. I just want them on any except the first page. Trying that I found the footer being different for first and second page. That is where the question comes from.. – mrCarnivore Apr 24 '23 at 07:34
  • @cabohah: Strangely trying the defining your own layer from your suggested answer works... But I do need an extra package scrlayer for that solution and that is not so nice when using an .lco file... So it works but not exactly as I want it to. But maybe that is impossible for whatever reason... – mrCarnivore Apr 24 '23 at 07:43
  • If you don't want the footer on the first page, why do you define it using \setkomavar{firstfoot}{…}, which is documented to be used on the first page??? Is is also documented, that variable nextfoot is only used with pagestyle myheadings or headings (see e.g. table 4.1). Moreover, using fanyhdr would also be an extra package and even an extra package, that is not recommended with KOMA-Script classes (see the warning in the log file). So IMHO currently your question is completely unclear and your comments also do not make it clear. – cabohah Apr 24 '23 at 08:35
  • @cabohah: I had already clarified that in a previous comment and now have also added this to my question. I do not want to use fancyhdr. I just wanted to show what I have tried and lead to even more strange results. Like stated before I do not understand why the \hrulefill breaks everything... – mrCarnivore Apr 24 '23 at 09:44
  • Sorry, but your new comment does not make it more clear. If you want a foot at every page but the first one, why do you use \setkomavar{firstfoot}{…}? And if the footer of all pages but the first one should have a foot separation line why don't you use KOMA-Script's option for foot separation lines? And if I'm wrong and you want the same foot at all pages inclusive the first one, why don't you use one of the solutions either from the wiki or the already linked one? I don't see the sense. I think, I should stop here, because it seams I'm too stupid to understand you. Sorry. :( – cabohah Apr 24 '23 at 09:54
  • @cabohah: I want only a footer on all pages except the first. That failed because the footer looked nothing like I wanted. So I then tried it as the firstfoot and it worked. That is not the goal but still shows what is wrong. I can use the foot separation line but still I would not understand why the same code works for firstfoot but not nextfoot... – mrCarnivore Apr 24 '23 at 10:05
  • As explained in the KOMA-Script manual (and also the wiki page already referred to), the variables for the first page and the variables for the other pages a placed different. For example firstfoot is printed on the first page not a s part of the page style but a part of the notepaper definition. – cabohah Apr 24 '23 at 10:14
  • 1
    This seems related: https://tex.stackexchange.com/q/426016/47927 – Jasper Habicht Apr 24 '23 at 10:19

1 Answers1

3

To print a footer with foot separation line at all pages but the first one, can for example use \setkomavar{nextfoot}{<footer definition>} and KOMA-Script option footsepline. But in this case note, that the foot line of the page style is specified to be a single line (inside horizontal box). So paragraphs, line breaks etc. won't work, unless you put them explicitly into a vertical box:

\documentclass[footsepline]{scrlttr2}

\renewcommand\familydefault{\sfdefault} \usepackage{tgheros}

\setkomafont{pagefoot}{\footnotesize} \setkomavar{nextfoot}{% \parbox{\linewidth}{% because it seems you want so have line breaks using \ \usekomavar{subject} \hfill \usekomavar{fromname} }% }

\pagestyle{myheadings}

\usepackage{blindtext}% Note: Changed because Blindtext.sty cannot be found with case sensitive file names.

\begin{document} \begin{letter}{recipient} \setkomavar{subject}{Evaluation\ student}

    \opening{Hello}

    \Blindtext

\end{letter}

\end{document}

Alternatively you could set the page footer using the recommended KOMA-Script package scrlayer-scrpage as already shown before, e.g., in scrlttr2: make second page footer match first page footer.

Note from the KOMA-Script author: Package scrletter, resp. class scrletter, which is a wrapper for class scrartcl and package scrletter, are not affected by the restriction to one line headers and footers. So another alternative would be:

\documentclass[footsepline,manualmark,footlines=2]{scrletter}

\renewcommand\familydefault{\sfdefault} \usepackage{tgheros}

\setkomafont{pagefoot}{\footnotesize} \setkomavar{nextfoot}{% \usekomavar{subject} \hfill \usekomavar{fromname}% }

\renewcommand*{\letterpagestyle}{letter}

\usepackage{blindtext}% Note: Changed because Blindtext.sty cannot be found with case sensitive file names.

\begin{document}

\begin{letter}{recipient}

    \setkomavar{subject}{Evaluation\\ student}

    \opening{Hello}

    \Blindtext

\end{letter}

\end{document}

cabohah
  • 11,455