From mboxrd@z Thu Jan 1 00:00:00 1970 From: Karsten Heymann Subject: Re: LaTeX package dependencies Date: Fri, 26 Mar 2010 10:51:10 +0100 Message-ID: <878w9fo1gx.fsf@ara.blue-cable.net> References: <87vdcjh8fh.wl%dmaus@ictsoc.de> <87fx3no3bf.fsf@ara.blue-cable.net> <68476A82-FD1A-4CBA-9A0B-A9A7D1ED3E10@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nv6CF-00054h-0p for emacs-orgmode@gnu.org; Fri, 26 Mar 2010 05:51:19 -0400 Received: from [140.186.70.92] (port=42819 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nv6CB-000538-16 for emacs-orgmode@gnu.org; Fri, 26 Mar 2010 05:51:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nv6C9-0007pe-0G for emacs-orgmode@gnu.org; Fri, 26 Mar 2010 05:51:14 -0400 Received: from mx2-node02.blue-cable.net ([62.117.12.124]:55596) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nv6C8-0007pW-R3 for emacs-orgmode@gnu.org; Fri, 26 Mar 2010 05:51:12 -0400 In-Reply-To: <68476A82-FD1A-4CBA-9A0B-A9A7D1ED3E10@gmail.com> (Carsten Dominik's message of "Fri, 26 Mar 2010 10:14:08 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: Org Mode Carsten, Carsten Dominik 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