emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] how putting \begin{document} at the right place to export a spec


From: Tim Cross
Subject: Re: [O] how putting \begin{document} at the right place to export a specific latex class ?
Date: Tue, 12 Jun 2018 08:58:39 +1000
User-agent: mu4e 0.9.18; emacs 26.1

Is this something you need on a permanent basis or is it just for one
document you need to produce?

If it is something you need on a permanent basis, then something like
what I have in my init.el file might work. (beware of the formatting
here - mail is likely to make a mess of it, so it may be easier to copy
the below into your *scratch* buffer and read it there.). This is just
an example of how you can 'tweak' the default org setup to use specific
Latex styles and classes. There are other ways to do it, but this one
has worked the best for me over the long term. 

<<<<<<
    (setq org-latex-classes
          '(("beamer"
             "\\documentclass[presentation]{beamer}"
             ("\\section{%s}" . "\\section*{%s}")
             ("\\subsection{%s}" . "\\subsection*{%s}")
             ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
            ("article"
             "\\documentclass[12pt]{hitec}
    [DEFAULT-PACKAGES]
    [PACKAGES]
    [NO-EXTRA]
    \\settextfraction{0.95}\n"
             ("\\section{%s}" . "\\section*{%s}")
             ("\\subsection{%s}" . "\\subsection*{%s}")
             ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
             ("\\paragraph{%s}" . "\\paragraph*{%s}")
             ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
            ("report"
             "\\documentclass[11pt]{report}"
             ("\\part{%s}" . "\\part*{%s}")
             ("\\chapter{%s}" . "\\chapter*{%s}")
             ("\\section{%s}" . "\\section*{%s}")
             ("\\subsection{%s}" . "\\subsection*{%s}")
             ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
            ("book"
             "\\documentclass[11pt]{book}"
             ("\\part{%s}" . "\\part*{%s}")
             ("\\chapter{%s}" . "\\chapter*{%s}")
             ("\\section{%s}" . "\\section*{%s}")
             ("\\subsection{%s}" . "\\subsection*{%s}")
             ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
            ("une-article"
             "\\documentclass[a4paper,12pt]{scrartcl}
    [DEFAULT-PACKAGES]
    [PACKAGES]
    \\usepackage[margin=1.5cm]{geometry}
    [EXTRA]\n"
             ("\\section{%s}" . "\\section*{%s}")
             ("\\subsection{%s}" . "\\subsection*{%s}")
             ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
             ("\\paragraph{%s}" . "\\paragraph*{%s}")
             ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
            ("une-logo"
             "\\documentclass[a4paper,12pt]{scrartcl}
    [DEFAULT-PACKAGES]
    [PACKAGES]
    \\usepackage[margin=1.5cm]{geometry}
    [EXTRA]
    \\definecolor{unegreen}{HTML}{7AB800}
    \\definecolor{Black}{HTML}{000000}
    \\definecolor{White}{HTML}{FFFFFF}
    \\definecolor{dimgrey}{HTML}{696969}
    \\makeatletter
    address@hidden
     \\noindent \\begin{minipage}[c][4cm][t]{\\linewidth}
       \\colorbox{Black}{%
         \\begin{minipage}[t][4cm][c]{4cm}
         \\flushleft
         \\includegraphics{~/.emacs.d/img/unelogo_medium.png}
       \\end{minipage}}
       \\colorbox{unegreen}{%
         \\begin{minipage}[t][4cm][c]{13.5cm}
           \\flushright
           \\Large address@hidden \\\\
            \\vspace{4pt}
           \\small address@hidden \\\\
           \\small address@hidden
         \\end{minipage}}
       \\end{minipage}}
    \\makeatother\n"
             ("\\section{%s}" . "\\section*{%s}")
             ("\\subsection{%s}" . "\\subsection*{%s}")
             ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
             ("\\paragraph{%s}" . "\\paragraph*{%s}")
             ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
            ("old-article" "\\documentclass[11pt]{article}"
             ("\\section{%s}" . "\\section*{%s}")
             ("\\subsection{%s}" . "\\subsection*{%s}")
             ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
             ("\\paragraph{%s}" . "\\paragraph*{%s}")
             ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
          )
>>>>>

The above defines a number of org document types I can use in
exports. You have

- beamer :: presentation
- article :: which is modified from default to use the 'hitec'
             Note the \settestfraction line used to modify the behaviour
             of the class.
- report :: standard report
- book :: standard book
- une-article :: customised work document using the scrartcl Korma
                 script class
- une-logo :: A work document which includes a logo.

This last one uses - \maketitle and \minipage as well as other standard
commands, all of - which need to be inserted into the latex document
before the \begin{}. Essentially, you can replace this with whatever
latex commands you need before the \begin{document} line.

To use this new class, I put the following in my org document

#+LATEX_CLASS: une-logo

and lines for #+TITLE:, #+SUBTITLE: etc.

Obviously, you will need to work out what needs to be added and
depending on what it is, you may need to modify some of the other
default settings, such as what is loaded via DEFAULT-PACKAGES, PACKAGES
and EXTRA, but this should give you an idea.

The downside with this approach is that it is a fair bit of work to
setup for a one off document. It is great for when you need to use a
specific setup frequently, but for a one-off, you are probably best off
just using org to generate the basic *.tex file and then tweaking that
file manually.

HTH

Tim

Joseph Vidal-Rosset <address@hidden> writes:

> Hello,
>
> Here  is my  problem: for  a specific  latex class  (xxllp.cls), I  have
> difficulties  to get  the \begin{document}  at the  right place  in this
> add-to-list:
>
> (add-to-list 'org-latex-classes
>              '("xxllp"
>                "\\documentclass\[oumk,xs]\{xxllp\}
>  [NO-DEFAULT-PACKAGES]
>  [NO-PACKAGES]
> \\usepackage{amsmath}
> \\usepackage{amssymb}
> \\usepackage{blabla}
> \\usepackage{blablabla}
> \\pagestyle{myheadings}\\markboth{Author}{Title of the paper}
>              \\LaLPonline{??} \\setcounter{page}{1} 
> \\thispagestyle{LLPrrobezissn} \\label{p}
> \\AuthorTitle{Joseph Vidal-Rosset}{\\uppercase{Title of the paper}}"
>                ("\\section\{%s\} . \\section*\{%s\}")
>                ("\\subsection\{%s\} . \\subsection*\{%s\}")
>              ))
>
>
> For this class, the \begin{document} should be just after
> \\pagestyle{myheadings}\\markboth{Author}{Title of the paper}
> and just before
>  \\LaLPonline{??} \\setcounter{page}{1} \\thispagestyle{LLPrrobezissn}
> \\label{p}
>
> but because I do not understand  clearly the syntax of the function, I
> do not succeed and the export does not work correctly.
>
> Any suggestion?


--
Tim Cross



reply via email to

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