emacs-orgmode
[Top][All Lists]
Advanced

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

Re: First steps exporting to tex


From: Juan Manuel Macías
Subject: Re: First steps exporting to tex
Date: Sat, 03 Apr 2021 14:10:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi Ypo,

I think that, as a starting point, the concepts that belong to Org and
those that belong to LaTeX should be separated.

Ypo writes:

> [...]
> 2  template.tex -> this could be added to the SETUPFILE:
>   #+LATEX_HEADER: \input{template.tex}. But it seems to have no effect
>   on the PDF output. BTW, I can't use emacs HOME path (~/) in the
>   input header, like \input{~//export//template.tex}.

The keyword #+LaTeX_Header pass literal LaTeX commands in a single line
to thepreamble. The LaTeX \input{...} command should follow the path of
the file you want include, but I see that you are indicating the path
with a double //. The correct way is \input{~/export/template.tex}

> 3 Another friend told me that .sty templates were the best way.

A *.sty file is what is known in LaTeX jargon as a "package", and it
would come to be the equivalent of what is a *.el file in Emacs,
/mutatis mutandis/. In a sty file you can put whatever you want, but a
different syntax must be used and these files are subject to a series of
good practices. Therefore, a sty file is more indicated to introduce
'heavy' code that you want reuse in other documents (defined commands
and macros, etc.). In short, what comes to be a package ;-) At the user
level, and unless you want to write your own package (see:
https://www.overleaf.com/learn/latex/Writing_your_own_package), it is
almost never necessary.

> 4 I see some people that create customized LaTeX classes and add the
>   desired class to the orgmode buffer.

Great care must be taken here. One thing is a LaTeX class, which is
something laborious and complex to write, and another thing what Org
understands for a LaTeX class :-) Classen and the class concept are a
essential component for LaTeX, as a class is the first thing you must
declare in a preamble with the command \documentclass{}. There are the
standard classes (article, book and others) and other ones, more
specialized. A class changes globally the behavior of the document and
all LaTeX commands as \section, \subsection and many more, and add its
own commands.

A 'LaTeX class' for Org is a light translation of the above. It is
actually "what type of LaTeX document you want to get".

You can easily define your own LaTeX 'classes' for Org documents. For
example: I have an 'empty class', to be able to add the entire preamble,
without Org charging me anything before the \begin{document}

(add-to-list 'org-latex-classes
      '("empty"
         "[NO-DEFAULT-PACKAGES]
         [PACKAGES]
         [EXTRA]"
         ("\\section{%s}" . "\\section*{%s}")
         ("\\subsection{%s}" . "\\subsection*{%s}")
         ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
         ("\\paragraph{%s}" . "\\paragraph*{%s}")
         ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

And I have in my ~/.emacs:

(setq org-latex-default-class "empty")
(setq org-latex-default-packages-alist nil)
(setq org-latex-packages-alist nil)
(setq org-latex-hyperref-template nil)

My advice, as has already been commented here, is that you get familiar
with LaTeX for a while, and then see how you can fit LaTeX in your Org
workflow, if that's more productive for you.

Best regards,

Juan Manuel



reply via email to

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