I'm using Pandoc to generate a PDF from a Markdown source file, and passing in a custom LaTeX template (effectively a tweaked version of the Pandoc default) to change the style of the final PDF.

I have 30 lines of LaTeX (which someone else wrote) that I want to insert in the template, but these make several changes to the font settings. I only want those changes to apply to these particular lines, but at the moment LaTeX is applying them to the rest of the document.

Is there a way to save the current font settings before these 30 lines of LaTeX, and then restore them afterwards? I don't know (or particularly care) what the current settings are, I just know I want them to be the same before and after.

Edit: What I want is:

[default font settings]
[30 lines of LaTeX with different font settings]
[default font settings]

Edit: Lines I want to insert:

  \includegraphics[height=18.5mm]{images/flossuksmaller}\hfill {\fontsize{32}{32}\selectfont
  \textit{The newsletter of FLOSS UK, the new name for the UK's oldest Open Systems User Group, UKUUG}
  Published electronically at
  \vspace{1 mm}

  \vspace{-1 mm}
  \bfseries Volume 24, Number 4\vspace{1 mm}
  ISSN 0965-9412\hfill
  % </number>
  December 2015\vspace{0 mm}


  • Why don't you just comment out the lines which changes the font settings? – schmendrich May 10 '16 at 12:59
  • Because I want those settings to apply to the 30 lines of LaTeX that I've pulled in (and only those 30 lines) – pwaring May 10 '16 at 13:02
  • try wrapping the block with the different settings between \begingroup and \endgroup. (without an example, i can't perform a valid test, but this is what i'd try first.) – barbara beeton May 10 '16 at 13:06
  • Show the 30 lines you want to insert. – Ulrike Fischer May 10 '16 at 13:06
  • \begingroup/\endgroup as suggested by barbara should work fine. – Ulrike Fischer May 10 '16 at 13:14

it's often possible to isolate or "quarantine" special settings by hiding them in a group. braces {...} will do this, but i find it much easier to read


this will not work for changes that are made globally. fortunately, in this case, font resettings are local.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.