From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Cross 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 Message-ID: <87k1r5hqw0.fsf@gmail.com> References: <87muw1a40g.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSVlv-0007db-SB for emacs-orgmode@gnu.org; Mon, 11 Jun 2018 18:58:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSVlu-0000gd-RR for emacs-orgmode@gnu.org; Mon, 11 Jun 2018 18:58:47 -0400 Received: from mail-pl0-x236.google.com ([2607:f8b0:400e:c01::236]:36737) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSVlu-0000g7-Hq for emacs-orgmode@gnu.org; Mon, 11 Jun 2018 18:58:46 -0400 Received: by mail-pl0-x236.google.com with SMTP id a7-v6so10684492plp.3 for ; Mon, 11 Jun 2018 15:58:46 -0700 (PDT) In-reply-to: <87muw1a40g.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Joseph Vidal-Rosset Cc: emacs-orgmode list 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 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