emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com>
Cc: emacs-orgmode list <emacs-orgmode@gnu.org>
Subject: Re: how putting \begin{document} at the right place to export a specific latex class ?
Date: Tue, 12 Jun 2018 08:58:39 +1000	[thread overview]
Message-ID: <87k1r5hqw0.fsf@gmail.com> (raw)
In-Reply-To: <87muw1a40g.fsf@gmail.com>


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
    \\def\\@maketitle{
     \\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 \\textbf{\\color{White}{\\@title}} \\\\
            \\vspace{4pt}
           \\small \\color{White}{\\@author} \\\\
           \\small \\color{White}{\\@date}
         \\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 <joseph.vidal.rosset@gmail.com> 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

  parent reply	other threads:[~2018-06-11 22:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 12:42 how putting \begin{document} at the right place to export a specific latex class ? Joseph Vidal-Rosset
2018-06-11 14:01 ` John Kitchin
2018-06-11 14:16   ` Joseph Vidal-Rosset
2018-06-11 14:23     ` John Kitchin
2018-06-11 15:29       ` Joseph Vidal-Rosset
2018-06-11 16:51         ` John Kitchin
2018-06-11 19:17 ` Nick Dokos
2018-06-11 22:58 ` Tim Cross [this message]
2018-06-12  7:08   ` Joseph Vidal-Rosset

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k1r5hqw0.fsf@gmail.com \
    --to=theophilusx@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=joseph.vidal.rosset@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).