I'm trying to design a package so that I can 'theme' a document quickly. I've done this, but as a sort of academic exercise I'm trying to design an option compact that adjusts margins, title, and layout to optimize the document for use of multicols.

The issue here is I want to use geometry to define the margins, but do not want to load thegeometry package otherwise. I have a little bit of a workaround by using \PassOptionsToPackage, but then the package is loaded even when the option is not selected and it changes LaTeX's default margins which I don't want to change in this default mode. Ideally, the textpos and multicol packages wouldn't be loaded unless the option is selected either, because they are otherwise unnecessary.

What is the most correct way of accomplishing this?

The custom package:



\setlength{\parskip}{6pt plus 2pt minus 2pt}



    \begin{tikzpicture}[remember picture, overlay]%
        \draw[right] (-.4em,.5em) node {#1};%
        \draw[line width=1pt] (-.4em,-2em) -- (-.4em,0em) -- (\dimexpr.4em+\linewidth, 0);%





MWE for custom package use:


    \stretchtitle{Minimum Working Example}


    \leveltwo{Second-Level Example}

  • 5
    See Loading a package conditionally, which states the use of an \if...\fi condition. – Werner Jan 13 '15 at 2:46
  • Use the [pass] option to geometry (tex.stackexchange.com/questions/179116/…). It loads the package without changing the existing parameters of the page. – Steven B. Segletes Jan 13 '15 at 2:48
  • Don't use \sf. It was deprecated 20+ years ago. Use \sffamily or \textsf{}. – cfr Jan 13 '15 at 2:50
  • @cfr oops... it's faster to type so I get lazy when I know I'm just going to be using article... but that's embarrassing... – Ryan Jan 13 '15 at 2:57
  • @Werner Thank you, that's a helpful answer, but in my case I want to manipulate the packages within the option definition, so I don't know how to make the program flow so that it will work. I'll read more on \if switches though. – Ryan Jan 13 '15 at 3:00