Carsten,

Carsten Dominik <carsten.domi...@gmail.com> 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


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to