emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* PDF export, table of contents and internal links
@ 2022-06-29 19:18 Sébastien Gendre
  2022-06-29 19:56 ` Juan Manuel Macías
  0 siblings, 1 reply; 4+ messages in thread
From: Sébastien Gendre @ 2022-06-29 19:18 UTC (permalink / raw)
  To: orgmode

Hello,

Recently I wrote a little document in Org-mode and I exported it to
LaTeX then PDF.

But I got a problem: In the PDF, there was no table of contents and the
internal links were absent.

In the PDF I had a "Table of contents" title, but only the title. Below
it, I got nothing.

On Org-mode side, the table of contents is not disable. And in the .tex
file, I got a "\tableofcontents" below the "\maketitle".

To generate the table of contents, I have to compile my .tex file into
PDF 2 times. The first time, I got no toc. The second time the toc was
here.

Same situation with internal links.

Did I got this problem because the generated PDF was 76 pages ?
How can I fix it so I can have toc generated from Org-mode export ?


Best regards.

-------
Sébastien




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PDF export, table of contents and internal links
  2022-06-29 19:18 PDF export, table of contents and internal links Sébastien Gendre
@ 2022-06-29 19:56 ` Juan Manuel Macías
  2022-06-29 22:02   ` Sébastien Gendre
  0 siblings, 1 reply; 4+ messages in thread
From: Juan Manuel Macías @ 2022-06-29 19:56 UTC (permalink / raw)
  To: Sébastien Gendre; +Cc: orgmode

Hi, Sébastien,

Sébastien Gendre writes:

> To generate the table of contents, I have to compile my .tex file into
> PDF 2 times. The first time, I got no toc. The second time the toc was
> here.

I would say It's a normal LaTeX thing. Sometimes LaTeX needs more than
one compilation to finish processing things like TOC or
cross-references, because it writes to auxiliary files if there has been
any change in those elements. What I suggest is that you use latexmk as
the default 'org-latex-pdf-process'. latexmk is a script that takes care
of intelligently compiling everything, as many times as necessary.

I have in my init:

(setq org-latex-pdf-process
      '("latexmk -lualatex -output-directory=%o -e '$lualatex=q/lualatex
      %%O -shell-escape %%S/' %f"))

(I use LuaTeX instead of pdfTeX).

Best regards,

Juan Manuel 




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PDF export, table of contents and internal links
  2022-06-29 19:56 ` Juan Manuel Macías
@ 2022-06-29 22:02   ` Sébastien Gendre
  2022-06-30 11:41     ` Juan Manuel Macías
  0 siblings, 1 reply; 4+ messages in thread
From: Sébastien Gendre @ 2022-06-29 22:02 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Thanks for your advice.

You remember me that, in the past, I had modified
"org-latex-pdf-process". I just forget about it.

By looking this variable with "describe-variable", I see its default
value is:
"latexmk -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f"

I modified it to be:
"%latex -shell-escape -interaction nonstopmode -output-directory %o %f"

Because, when I wanted to add "-shell-escape" option to latexmk, it
seemed too complex to me.

If I learned LaTeX syntax in the past, I never take enough time to learn
how work each compilation possibility. I feel lost with all the
pdflatex, teklive, lualatex, double or quadruple compilation, etc.

Do you have good articles or book to suggest about this part of LaTeX ?

To come back to "org-latex-pdf-process", I only added "-shell-escape"
for the minted package. To have beautify code block. But maybe it exist
better solution ? Someone have experience with Engrave Faces ?


Juan Manuel Macías <maciaschain@posteo.net> writes:

> Hi, Sébastien,
>
> Sébastien Gendre writes:
>
>> To generate the table of contents, I have to compile my .tex file into
>> PDF 2 times. The first time, I got no toc. The second time the toc was
>> here.
>
> I would say It's a normal LaTeX thing. Sometimes LaTeX needs more than
> one compilation to finish processing things like TOC or
> cross-references, because it writes to auxiliary files if there has been
> any change in those elements. What I suggest is that you use latexmk as
> the default 'org-latex-pdf-process'. latexmk is a script that takes care
> of intelligently compiling everything, as many times as necessary.
>
> I have in my init:
>
> (setq org-latex-pdf-process
>       '("latexmk -lualatex -output-directory=%o -e '$lualatex=q/lualatex
>       %%O -shell-escape %%S/' %f"))
>
> (I use LuaTeX instead of pdfTeX).
>
> Best regards,
>
> Juan Manuel 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PDF export, table of contents and internal links
  2022-06-29 22:02   ` Sébastien Gendre
@ 2022-06-30 11:41     ` Juan Manuel Macías
  0 siblings, 0 replies; 4+ messages in thread
From: Juan Manuel Macías @ 2022-06-30 11:41 UTC (permalink / raw)
  To: orgmode

Sébastien Gendre writes:

> If I learned LaTeX syntax in the past, I never take enough time to learn
> how work each compilation possibility. I feel lost with all the
> pdflatex, teklive, lualatex, double or quadruple compilation, etc.

The problem of multiple compilations is not related, in general, to the
TeX engine being used (pdfTeX, XeTeX, LuaTeX) but to LaTeX itself, which
continually needs to write and read auxiliary files. If, in addition,
you need to use citations, add an analytical index or other elements to
your work, you will also have to call the corresponding engines (bibtex,
biber, xindy, etc.) and compile again. And to all this is added that
there are specific packages that also need more than one compilation. So
it's often the best idea to let latexmk take care of all that instead of
compiling manually.

You may be interested in taking a look at another TeX format, ConTeXt,
not as popular as LaTeX but very powerful. It has certain advantages
over LaTeX. For my workflow, I prefer LaTeX. But there are users who can
be better served by ConTeXt, and they should be aware of it. Unlike
LaTeX, whose concept is of a minimal kernel that can be extended by
packages, ConTeXt starts from a monolithic kernel, which includes
everything or almost everything. In other words, it is not necessary to
load a package for this, another package for that, etc. Its interface is
more minimalist than the LaTeX interface and its compilation process is
(I think) faster. And, on the Org side, we luckily already have a
ConTeXt exporter, ox-context, written by Jason Ross:

https://github.com/Jason-S-Ross/ox-context/

There is a very complete introductory manual to ConTeXt written by
Joaquín Ataz López, with translations into various languages, including
English and French:

https://github.com/contextgarden/not-so-short-introduction-to-context

> Do you have good articles or book to suggest about this part of LaTeX ?

A good read might be: /The Not so Short Introduction to LaTeX2e/
(https://scholar.google.com/scholar?q=the not so short introduction to
latex2e)

And if you dare to program at a low level in pure TeX, this is very
good: /TeX for the Impatient/
(http://mail.tug.org/TUGboat/tb11-4/tb30ads.pdf)

> To come back to "org-latex-pdf-process", I only added "-shell-escape"
> for the minted package. To have beautify code block. But maybe it exist
> better solution ? Someone have experience with Engrave Faces ?

The -shell-escape flag only makes sense if you need to call an external
process during compilation (as in the case of minted). It is also
necessary if you need to use an indexing engine like xindy. But apart
from these cases and some more, an org user will have more advantages
using babel.

I use Minted, but I'm not convinced. It also has some problems with
certain LaTeX packages. I have Engrave Faces on my TODO list to try. And
possibly I will migrate to it...

Best regards,

Juan Manuel 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-30 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-29 19:18 PDF export, table of contents and internal links Sébastien Gendre
2022-06-29 19:56 ` Juan Manuel Macías
2022-06-29 22:02   ` Sébastien Gendre
2022-06-30 11:41     ` Juan Manuel Macías

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).