emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] LaTeX package dependencies


From: Karsten Heymann
Subject: Re: [Orgmode] LaTeX package dependencies
Date: Fri, 26 Mar 2010 10:51:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Carsten,

Carsten Dominik <address@hidden> writes:
> seems like you know what you are talking about.

A little bit, although sadly I had few chances to actually use LaTeX
since I left the University. So I enjoy this even more :-)

> So maybe you can help me with this.
>
> I would like to
>
> 1. Require these packages with \usepackage or similar, but not
>    have an error thrown when they are not available
>
> 2. Provide, as you say, alternative versions with providecommand.
>    How would I do this?  What do you mean by simple-text-alternatives?

I put the answer to both questions into a minimal example:

\documentclass{minimal} % should work with any document class
\IfFileExists{mnsymbol.sty}{%
  \usepackage{mnsymbol}
}{%
  \PackageWarning{orgmode}{mnsymbol.sty not found, using fall-back-replacements}
}
\providecommand*{\mnstar}{*} % provide alternative in case command not available

\begin{document}
\mnstar
\end{document}


Some notes:

 - IfFileExists finds the sty file anywhere in the tex load
   path (you can verify this with "kpsewhich FILE" on the commandline).
   These commands are explained in the LaTeX Class writing guide:
   texdoc clsguide
 - \providecommand* is the same as \providecommand, but saves a tiny bit
   of memory as no arguments are allowed that contain multiple
   paragraphs (not making the *-variant the default for \providecommand
   and \newcommand is in my opinion clearly a design flaw of LaTeX).

Hope to help,

Karsten




reply via email to

[Prev in Thread] Current Thread [Next in Thread]