From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Custom title page in org-mode Date: Wed, 21 Dec 2011 17:15:46 -0500 Message-ID: <8088.1324505746@alphaville.americas.hpqcorp.net> References: Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:53656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdUSA-0007y5-01 for Emacs-orgmode@gnu.org; Wed, 21 Dec 2011 17:16:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RdUS8-0001Nn-5A for Emacs-orgmode@gnu.org; Wed, 21 Dec 2011 17:16:01 -0500 Received: from g4t0016.houston.hp.com ([15.201.24.19]:30357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdUS7-0001NF-KM for Emacs-orgmode@gnu.org; Wed, 21 Dec 2011 17:15:59 -0500 In-Reply-To: Message from "Steve Prud'Homme" of "Wed, 21 Dec 2011 13:17:01 EST." 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Steve Prud'Homme Cc: nicholas.dokos@hp.com, Emacs-orgmode@gnu.org Steve Prud'Homme 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 \@titlepagefalse to \@titlepagetrue 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 @@ \newcommand\@ptsize{} \newif\if@restonecol \newif\if@titlepage -\@titlepagefalse +\@titlepagetrue \if@compatibility\else \DeclareOption{a4paper} {\setlength\paperheight {297mm}% @@ -123,7 +123,7 @@ \input{size1\@ptsize.clo} \setlength\lineskip{1\p@} \setlength\normallineskip{1\p@} -\renewcommand\baselinestretch{} +\renewcommand\baselinestretch{1.3} \setlength\parskip{0\p@ \@plus \p@} \@lowpenalty 51 \@medpenalty 151 @@ -514,6 +514,7 @@ \@mkboth{% \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}% \@starttoc{toc}% + \newpage% } \newcommand*\l@part[2]{% \ifnum \c@tocdepth >-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).