Skip to content

Instantly share code, notes, and snippets.

@tueda
Created April 28, 2015 00:29
Show Gist options
  • Select an option

  • Save tueda/720d4783321fea5e1ce6 to your computer and use it in GitHub Desktop.

Select an option

Save tueda/720d4783321fea5e1ce6 to your computer and use it in GitHub Desktop.
An example of LaTeX file, which can be typeset both as a standalone file and a source that can be included by another file via \input.
\makeatletter
\newif\ifStandalone
\ifx\documentclass\@twoclasseserror
\Standalonefalse
\else
\Standalonetrue
\fi
\makeatother
\ifStandalone
\documentclass{article}
\pagestyle{empty}
\begin{document}
\fi
%
\setlength\unitlength{1cm}
\fbox{%
\begin{picture}(2,2)
\put(0,0){\line(1,0){2}}
\end{picture}%
}%
%
\ifStandalone
\end{document}
\fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment