emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Karsten Heymann <karsten.heymann@blue-cable.net>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: LaTeX package dependencies
Date: Fri, 26 Mar 2010 10:51:10 +0100	[thread overview]
Message-ID: <878w9fo1gx.fsf@ara.blue-cable.net> (raw)
In-Reply-To: <68476A82-FD1A-4CBA-9A0B-A9A7D1ED3E10@gmail.com> (Carsten Dominik's message of "Fri, 26 Mar 2010 10:14:08 +0100")

Carsten,

Carsten Dominik <carsten.dominik@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

  reply	other threads:[~2010-03-26  9:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-26  4:52 LaTeX package dependencies Carsten Dominik
2010-03-26  7:02 ` David Maus
2010-03-26  9:11   ` Karsten Heymann
2010-03-26  9:14     ` Carsten Dominik
2010-03-26  9:51       ` Karsten Heymann [this message]
2010-03-26 19:22   ` John Hendy
2010-03-26  8:24 ` Alexander Poslavsky
2010-03-26  9:40 ` Robert Klein
2010-03-26 11:54   ` Mikael Fornius
2010-03-26 14:00     ` Matt Lundin
2010-03-26 14:27       ` Darlan Cavalcante Moreira
2010-03-26 18:42 ` Manish
2010-03-27  2:27   ` John Hendy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878w9fo1gx.fsf@ara.blue-cable.net \
    --to=karsten.heymann@blue-cable.net \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).