From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Leifer Subject: Re: Re: [PATCH] Compiling multiple times the LaTeX output Date: Wed, 6 Oct 2010 21:39:17 +0100 Message-ID: References: <87zkv0pqyi.fsf@mundaneum.com> <87r5gcshnf.fsf@noorul.maa.corp.collab.net> <874od7uzsa.fsf_-_@mundaneum.com> <30671.1285861145@gamaville.dokosmarshall.org> <87vd5njhm8.fsf@mundaneum.com> <21895.1285949541@alphaville.usa.hp.com> <87mxqrek7p.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0659389643==" Return-path: Received: from [140.186.70.92] (port=60411 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3am5-0006jQ-Mt for emacs-orgmode@gnu.org; Wed, 06 Oct 2010 16:39:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P3am4-0007JZ-48 for emacs-orgmode@gnu.org; Wed, 06 Oct 2010 16:39:41 -0400 Received: from mail-iw0-f169.google.com ([209.85.214.169]:60227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P3am3-0007JG-UM for emacs-orgmode@gnu.org; Wed, 06 Oct 2010 16:39:40 -0400 Received: by iwn2 with SMTP id 2so697513iwn.0 for ; Wed, 06 Oct 2010 13:39:38 -0700 (PDT) In-Reply-To: <87mxqrek7p.fsf@gmail.com> 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: emacs-orgmode Cc: Bruno Tavernier --===============0659389643== Content-Type: multipart/alternative; boundary=000325579d92a8337d0491f8c6ca --000325579d92a8337d0491f8c6ca Content-Type: text/plain; charset=ISO-8859-1 That is odd. texi2dvi should default to using regular latex. You usually have to pass a -p option or use the alias texi2pdf in order to use pdflatex. It might be that you have a LATEX environment variable set. In any case, you can alter this behaviour by setting the LATEX environment variable, e.g. setting the variable LATEX=xelatex will make texi2dvi use xelatex instead of regular latex. Finally, regarding .eps files, note that the latest version of pdflatex can handle .eps graphics without having to go through the latex->dvips->ps2pdf route so it might be worth your while upgrading. Failing that, you can put \usepackage{epstopdf} in your preamble and then older versions of pdflatex will work just fine. Best, Matt Leifer On 6 October 2010 10:36, Bruno Tavernier wrote: > Just tried the texi2dvi command that is nice, one problem though, it > only makes use of pdflatex. > > In certain situations, I like to use latex+ps2pdf (some journals ask for > .eps image file) or xelatex when mixing several fonts and writing in > UTF-8 is mandatory, for example French + Japanese, Chinese, Hindi, etc. > > Currently I used the function below that I hook to the org-export-latex > process. > > AFAIK, providing one use few packages, a .tex file to be used with > pdflatex can be similar to one to be used with xelatex. The content of > the document (UTF-8 characters) will make the difference. > > To circumvent this problem, considering pdflatex as the default option, > I add to the org file a: > "#+LATEX_CMD: xelatex" or "#+LATEX_CMD: latex" > > Note: bibtex and glossaries compilation are detected by their call, > e.g. \bibliography > > How about introducing a "#+LATEX_CMD:" option in org-mode? (and default > to pdflatex) > > ,---- > | ; Perform a 2 or 3 xe/pdf/latex compilation > | ; tex: tex + (glossaries) + (bibtex + tex) + tex > | > | (defun my-auto-tex-cmd () > | "Automatically select the tex command to apply." > | (let ((texcmd) (bibtexcmd) (glossariescmd) (dvi2pdfcmd)) > | ; default command > | (setq texcmd "pdflatex -interaction nonstopmode %f;") > | ; latex -> .dvi (for .eps images) > | (if (string-match "LATEX_CMD: latex" (buffer-string)) > | (progn > | (setq texcmd "latex -interaction nonstopmode %f;") > | (setq dvi2pdfcmd "dvips %b.dvi; ps2pdf %b.ps")) > | ; xelatex -> .pdf > | (if (string-match "LATEX_CMD: xelatex" (buffer-string)) > | (setq texcmd "xelatex -interaction nonstopmode %f;"))) > | ; first tex compilation command > | (setq org-latex-to-pdf-process (list texcmd)) > | ; look for glossaries call > | (if (string-match "\\\\makeglossaries" (buffer-string)) > | (progn > | (setq glossariescmd "makeindex -s %b.ist -t %b.glg -o %b.gls > %b.glo;") > | (setq org-latex-to-pdf-process > | (nconc org-latex-to-pdf-process (list glossariescmd))))) > | ; look for bibtex call > | (if (string-match "\\\\bibliography" (buffer-string)) > | (progn > | (setq bibtexcmd (concat "bibtex %b; " texcmd)) > | (setq org-latex-to-pdf-process > | (nconc org-latex-to-pdf-process (list bibtexcmd))))) > | ; last tex compilation command > | (setq org-latex-to-pdf-process > | (nconc org-latex-to-pdf-process (list texcmd))) > | ; dvi -> pdf > | (if dvi2pdfcmd > | (setq org-latex-to-pdf-process > | (nconc org-latex-to-pdf-process (list dvi2pdfcmd)))))) > | > | (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-cmd) > `---- > > > That also allow for customisation of the export of packages, for instance: > > ,---- > | ; Default packages > | (setq org-export-latex-packages-alist > | '(("" "graphicx" t) > | ("" "longtable" nil) > | ("" "amssymb" t) > | ("" "color" t) > | ("pdfborder=0" "hyperref" nil) > | ("" "float" nil))) > | > | ; Custom packages > | (defun my-auto-tex-parameters () > | "Automatically select the tex packages." > | ; Default pdflatex > | (setq org-export-latex-default-packages-alist > | '(("AUTO" "inputenc" t))) > | ; Look for xelatex call > | (if (string-match "LATEX_CMD: xelatex" (buffer-string)) > | (setq org-export-latex-default-packages-alist > | '(("" "fontspec" t)))) > | > | (add-hook 'org-export-latex-after-initial-vars-hook > 'my-auto-tex-parameters) > `---- > > > -- > Bruno > > _______________________________________________ > 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 > --000325579d92a8337d0491f8c6ca Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable That is odd. =A0texi2dvi should default to using regular latex. =A0You usua= lly have to pass a -p option or use the alias texi2pdf in order to use pdfl= atex. =A0It might be that you have a LATEX environment variable set. =A0In = any case, you can alter this behaviour by setting the LATEX environment var= iable, e.g. setting the variable LATEX=3Dxelatex will make texi2dvi use xel= atex instead of regular latex. =A0

Finally, regarding .eps files, note that the latest version = of pdflatex can handle .eps graphics without having to go through the latex= ->dvips->ps2pdf route so it might be worth your while upgrading. =A0F= ailing that, you can put \usepackage{epstopdf} in your preamble and then ol= der versions of pdflatex will work just fine.

Best,

Matt Leifer

On 6 October 2010 10:36, Bruno Tavernier <tavernier.bruno@g= mail.com> wrote:
Just tried the texi2dvi command that is nic= e, one problem though, it
only makes use of pdflatex.

In certain situations, I like to use latex+ps2pdf (some journals ask for .eps image file) or xelatex when mixing several fonts and writing in
UTF-8 is mandatory, for example French + Japanese, Chinese, Hindi, etc.

Currently I used the function below that I hook to the org-export-latex
process.

AFAIK, providing one use few packages, a .tex file to be used with
pdflatex can be similar to one to be used with xelatex. The content of
the document (UTF-8 characters) will make the difference.

To circumvent this problem, considering pdflatex as the default option,
I add to the org file a:
"#+LATEX_CMD: xelatex" or "#+LATEX_CMD: latex"

Note: bibtex and glossaries compilation are detected by their call,
e.g. \bibliography

How about introducing a "#+LATEX_CMD:" option in org-mode? (and d= efault
to pdflatex)

,----
| ; Perform a 2 or 3 xe/pdf/latex compilation
| ; tex: tex + (glossaries) + (bibtex + tex) + tex
|
| (defun my-auto-tex-cmd ()
| =A0 "Automatically select the tex command to apply."
| =A0 (let ((texcmd) (bibtexcmd) (glossariescmd) (dvi2pdfcmd))
| =A0 =A0 ; default command
| =A0 =A0 (setq texcmd "pdflatex -interaction nonstopmode %f;") | =A0 =A0 ; latex -> .dvi (for .eps images)
| =A0 =A0 (if (string-match "LATEX_CMD: latex" (buffer-string)) | =A0 =A0 =A0 (progn
| =A0 =A0 =A0 =A0 (setq texcmd "latex -interaction nonstopmode %f;&quo= t;)
| =A0 =A0 =A0 =A0 (setq dvi2pdfcmd "dvips %b.dvi; ps2pdf %b.ps"))
| =A0 =A0 =A0 ; xelatex -> .pdf
| =A0 =A0 =A0 (if (string-match "LATEX_CMD: xelatex" (buffer-stri= ng))
| =A0 =A0 =A0 =A0 (setq texcmd "xelatex -interaction nonstopmode %f;&q= uot;)))
| =A0 =A0 ; first tex compilation command
| =A0 =A0 (setq org-latex-to-pdf-process (list texcmd))
| =A0 =A0 ; look for glossaries call
| =A0 =A0 (if (string-match "\\\\makeglossaries" (buffer-string))=
| =A0 =A0 =A0 (progn
| =A0 =A0 =A0 =A0 (setq glossariescmd "makeindex -s %b.ist -t %b.glg -= o %b.gls %b.glo;")
| =A0 =A0 =A0 =A0 (setq org-latex-to-pdf-process
| =A0 =A0 =A0 =A0 =A0 =A0 =A0 (nconc org-latex-to-pdf-process (list glossar= iescmd)))))
| =A0 =A0 ; look for bibtex call
| =A0 =A0 (if (string-match "\\\\bibliography" (buffer-string)) | =A0 =A0 =A0 (progn
| =A0 =A0 =A0 =A0 (setq bibtexcmd (concat "bibtex %b; " texcmd))<= br> | =A0 =A0 =A0 =A0 (setq org-latex-to-pdf-process
| =A0 =A0 =A0 =A0 =A0 =A0 =A0 (nconc org-latex-to-pdf-process (list bibtexc= md)))))
| =A0 =A0 ; last tex compilation command
| =A0 =A0 (setq org-latex-to-pdf-process
| =A0 =A0 =A0 =A0 (nconc org-latex-to-pdf-process (list texcmd)))
| =A0 =A0 ; dvi -> pdf
| =A0 =A0 (if dvi2pdfcmd
| =A0 =A0 =A0 (setq org-latex-to-pdf-process
| =A0 =A0 =A0 =A0 =A0 =A0 (nconc org-latex-to-pdf-process (list dvi2pdfcmd)= )))))
|
| (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-= cmd)
`----


That also allow for customisation of the export of packages, for instance:<= br>
,----
| ; Default packages
| (setq org-export-latex-packages-alist
| =A0 =A0 =A0 '(("" "graphicx" t)
| =A0 =A0 =A0 ("" "longtable" nil)
| =A0 =A0 =A0 ("" "amssymb" t)
| =A0 =A0 =A0 ("" "color" t)
| =A0 =A0 =A0 ("pdfborder=3D0" "hyperref" nil)
| =A0 =A0 =A0 ("" "float" nil)))
|
| ; Custom packages
| (defun my-auto-tex-parameters ()
| =A0 "Automatically select the tex packages."
| =A0 ; Default pdflatex
| =A0 (setq org-export-latex-default-packages-alist
| =A0 =A0 =A0 '(("AUTO" "inputenc" t)))
| =A0 ; Look for xelatex call
| =A0 (if (string-match "LATEX_CMD: xelatex" (buffer-string))
| =A0 =A0 =A0 (setq org-export-latex-default-packages-alist
| =A0 =A0 =A0 =A0 =A0 '(("" "fontspec" t))))
|
| (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-= parameters)
`----


--
Bruno

_______________________________________________
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

--000325579d92a8337d0491f8c6ca-- --===============0659389643== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0659389643==--