auctex-devel
[Top][All Lists]
Advanced

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

Re: set the latex binaries, locally to different texlive distributions


From: David Kastrup
Subject: Re: set the latex binaries, locally to different texlive distributions
Date: Thu, 08 Jun 2023 17:17:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Uwe Brauer <oub@mat.ucm.es> writes:

> Hi 
>
>
> It so happens that a share a (mercurial) repository with latex files
> with a colleague. This colleague has only texlive 2019 installed why I
> upgraded to 2023 (but I still have 2019 installed. I install different
> texlive distributions in different directories and then set appropriate
> links. Now the nicematrix.sty gives some problems.
>
> Somebody on the german tex group provided me with a clever if, so if the
> file is compiled with texlive 2019 a certain style file is loaded and if
> 2023 another style file is loaded.
>
> Now I have been warned that such a solution might be unstable, and this
> why the following occurred to me.
>
> Could I set just for this file, the binaries, that auctex will use
> (pdflatex or xelatex) locally to use the ones provided by texlive 2019
> (they are in my case in /usr/local/texlive/2019/bin
>
> So is there any variable for doing this? I used apropos and searched
> for latex-program or similar but could not find anything.
>
> Somebody has an idea?

Personally, I have the following in my .emacs file:

(defun TeXlive (year)
  "Use TeXlive with the given year (given as string), nil if no TeXlive."
  (interactive
   (let* ((year
           (directory-files "/usr/local/texlive/" nil "\\`[0-9]+\\'")))
     (setq year
           (completing-read (format "Year to use (default %s): "
                                    (car (last year)))
                            (cons "none" year)
                            nil t nil nil (car (last year))))
     (list (unless (string= year "none") year))))
  (let ((path (getenv "PATH")))
    (while (string-match "/usr/local/texlive/[0-9]+/bin/[^:/]*:" path)
      (setq path (replace-match "" t t path)))
    (when year
      (let* ((dir (format "/usr/local/texlive/%s/bin" year))
             (defs (directory-files dir nil "\\`[-a-zA-Z0-9_]+\\'"))
             (arch (cond ((null defs) (error "No architectures in %s" dir))
                         ((null (cdr defs)) (car defs))
                         (t
                          (completing-read "Architecture? " defs nil t nil nil 
defs)))))
        (setq path (concat dir "/" arch ":" path))))
    (setenv "PATH" path)))

I call it as

M-x TeXlive RET

and it looks up the TeXlive versions (under /usr/local/texlive) that
have binaries installed and then asks which year to use, defaulting to
the newest.  In case multiple architectures are installed (I had 32bit
and 64bit executables in parallel at some point of time) it also asks
for the architecture.

-- 
David Kastrup



reply via email to

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