NOAA-EDAB / SOE-NEFMC

State of the Ecosystem report (New England Fishery Management Council)
6 stars 1 forks source link

latex header fixes for 2022 report #6

Open sgaichas opened 3 years ago

sgaichas commented 3 years ago

In 2021 there were difficulties knitting to pdf with our previous header due to changes in LaTeX in 2020.

A header example that works in R4.0+ with tinytex is posted here. This should work across operating systems (I hope).

This should allow us to get rid of the discontinued everypage LaTeX package that we hacked in with everypage-1x

New code is here to replace the \AddEverypageHook{% block:

\fancyheadinit{%
   \ifthenelse{\value{page}=X}%
      {\fancyhead[R]{\includegraphics[width=40pt]{images/NOAA_logo.png} \\ \textsf{\emph{DATE YEAR}}}
       \fancyhead[L]{\textsf{\LARGE State of the Ecosystem YEAR: REGION}}
      }%
      {\fancyhead[R]{}
       \fancyhead[L]{\textsf{\emph{State of the Ecosystem YEAR: REGION}}}
      }
}

I also had to adjust the header line width by adding \fancyheadoffset[L]{0.5cm} above the code block, because it wasn't full width in my doc. This may not be necessary for the SOEs.

Changes to the .Rmd file include ensuring that "null" didn't get entered for the title--leave blank in yaml--and the line \thispagestyle{fancy} may need to be added after the \setcounter{page}{X} statement.

sgaichas commented 2 years ago

@slucey for when you start the NEFSC SOE Rmd: this year I updated a few things in the latex header, including getting rid of older latex packages we aren't really using, and I was able to knit everything using R4+ and tinytex on my newer computer that doesn't have a standalone latex installation (once I got the page numbers right !) see header1.tex

slucey commented 2 years ago

Thanks! I should be starting on the New England document soon and will let you know if I run into any issues.