emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Custom title page in org-mode


From: Nick Dokos
Subject: Re: [O] Custom title page in org-mode
Date: Wed, 21 Dec 2011 17:15:46 -0500

Steve Prud'Homme <address@hidden> wrote:

> Ok so i use emacs for school work.
> I was trying to make a custom title page because, the default latex
> custom page do not respect my teacher standard
> 
> So my org-file look like that :
> 
> French comment : Exemple de page titre de l'UQAM int=E9gr=E9e dans un fichi=
> er.org
> 
> #+LaTeX_CLASS: report
> #+LaTeX: \renewcommand{\baselinestretch}{1.5}
> #+latex_header: \usepackage[french]{babel}
> #+LaTeX: \begin{document}
> #+LaTeX:\begin{center}
> #+LaTeX:\thispagestyle{empty}
> #+LaTeX:\textbf {Universit=E9 du Qu=E9bec =E0 Montr=E9al} \\
> #+LaTeX:\vspace*{\fill}
> #+LaTeX:Travail =E9crit : Mon m=E9tier d'hier =E0 aujourd'hui\\
> #+LaTeX:\vspace*{\fill}
> #+LaTeX:Travail pr=E9sent=E9 =E0\\
> #+LaTeX:Mme Sophie Grossman\\
> #+LaTeX:\vspace*{\fill}
> #+LaTeX:Dans le cadre du cours\\
> #+LaTeX:FPT 1402, groupe 20, R=E9flexion critique sur le m=E9tier, la techn=
> ique\\
> #+LaTeX:\vspace*{\fill}
> #+LaTeX:Par\\
> #+LaTeX:\textbf{Joseph Beno=EEt Steve Prud'Homme}\\
> #+LaTeX:PRUS28108006\\
> #+LaTeX:\vspace*{\fill}
> #+LaTeX:Programme\\
> #+LaTeX:Baccalaur=E9at d'enseignement en formation professionnelle et techn=
> ique
> #+LaTeX:Concentration en formation professionnelle au secondaire\\
> #+LaTeX:\vspace*{\fill}
> #+LaTeX:25 octobre 2010\\
> #+LaTeX:\vspace*{\fill}
> #+LaTeX:\end{center}
> 
> 
> * Introduction et compr=E9hension de la th=E9matique
> (...)
> 

Ugh.

> The problem it is possible to cancel the default latex title page in
> my org-file.
> It is possible te place the table of content after the custom title page.
> I know that is latex question but i want to rest in my .org file and
> not edit my .tex file.
> 

This is actually not a latex question: the org latex exporter does these
things in a standard way. It may be possible to override some or all of
this behavior, but I haven't checked because I think there is a better
method.

If I were you, what I would do is make my own LaTeX class. Start from
the one closest to the desired result (probably article), incorporate
whatever changes you want from report.cls (in particular, the page
breaks you want), make whatever changes you want to the \title, \author
etc.  macros, save the result as myarticle.cls in the same directory as
your org file, and add an entry for it to org-export-latex-classes. Then
add a

#+LaTeX_CLASS: myarticle

to your org file and off you go.

In more detail:

1) I copied the official article.cls to myarticle.cls in the current
   directory with

    cp $(kpsewhich article.cls) myarticle.cls

2) In myarticle.cls, I changed address@hidden to address@hidden in
   order to get a separate title page, and I added a \newpage at the end
   of the \tableofcontents macro (btw, report.cls does the latter in a
   subtler way, but never mind about that) and just for the heck of it,
   I also changed the baselinestretch - but I think this last is better done
   in a different way [fn:1]:

--8<---------------cut here---------------start------------->8---
$ diff -u $(kpsewhich article.cls)  myarticle.cls
--- /usr/share/texmf-texlive/tex/latex/base/article.cls 2009-09-28 
11:31:27.000000000 -0400
+++ myarticle.cls       2011-12-21 16:50:18.150992695 -0500
@@ -58,7 +58,7 @@
 address@hidden
 address@hidden
 address@hidden
address@hidden
address@hidden
 address@hidden
 \DeclareOption{a4paper}
    {\setlength\paperheight {297mm}%
@@ -123,7 +123,7 @@
 address@hidden
 address@hidden
 address@hidden
-\renewcommand\baselinestretch{}
+\renewcommand\baselinestretch{1.3}
 \setlength\parskip{0\p@ address@hidden address@hidden
 address@hidden   51
 address@hidden  151
@@ -514,6 +514,7 @@
         address@hidden
            \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
     address@hidden
+    \newpage%
     }
 address@hidden
   \ifnum address@hidden >-2\relax
--8<---------------cut here---------------end--------------->8---


3) I added a stanza to org-export-latex-classes (I did that temporarily
   in my *scratch* buffer, but you can add it to .emacs if you want):

--8<---------------cut here---------------start------------->8---
(add-to-list 'org-export-latex-classes
             '("myarticle" "\\documentclass[11pt]{myarticle}"
               ("\\section{%s}" . "\\section*{%s}")
               ("\\subsection{%s}" . "\\subsection*{%s}")
               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
               ("\\paragraph{%s}" . "\\paragraph*{%s}")
               ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
--8<---------------cut here---------------end--------------->8---

4) I added the LaTeX_CLASS line to my org file:


--8<---------------cut here---------------start------------->8---
#+LaTeX_CLASS: myarticle
--8<---------------cut here---------------end--------------->8---


That's all that's needed to produce separate title and TOC pages and
keep the rest of the article class intact. If you don't like the
titlepage format, you can modify it to your heart's content: you will
need to figure out the LaTeX part to do that, but that's not as
difficult as you might think it is at first sight - and I guarantee that
you will have an easier time this way than fighting the org latex
exporter, a fight that you will probably lose :-) IMO, of course.

Nick

Footnotes:

[fn:1] Bastien is right that redefining \baselinestretch is better than
mucking around with the \baselineskip as I suggested (see
e.g. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=linespace )

It's probably even better to do it like this however:

--8<---------------cut here---------------start------------->8---
#+LaTeX_HEADER: \usepackage{setspace}\doublespacing
--8<---------------cut here---------------end--------------->8---

or

--8<---------------cut here---------------start------------->8---
#+LaTeX_HEADER: \usepackage{setspace}\onehalfspacing
--8<---------------cut here---------------end--------------->8---

or if you don't like the built-in factors, choose your own:

--8<---------------cut here---------------start------------->8---
#+LaTeX_HEADER: \usepackage{setspace}\setstretch{1.3}
--8<---------------cut here---------------end--------------->8---

BTW, I think the factors are logarithmic: doublespacing is about 1.66
and onehalfspacing is 1.25 or so (depending on the font size).



reply via email to

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