emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Steve Prud'Homme <sprudhom@gmail.com>
Cc: nicholas.dokos@hp.com, Emacs-orgmode@gnu.org
Subject: Re: Custom title page in org-mode
Date: Wed, 21 Dec 2011 17:15:46 -0500	[thread overview]
Message-ID: <8088.1324505746@alphaville.americas.hpqcorp.net> (raw)
In-Reply-To: Message from "Steve Prud'Homme" <sprudhom@gmail.com> of "Wed, 21 Dec 2011 13:17:01 EST." <CAN6y2uifqu1SS+5PuZfN2pUzvq+wMhz83ZpU1NiUOqe35DRAmw@mail.gmail.com>

Steve Prud'Homme <sprudhom@gmail.com> 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).

  reply	other threads:[~2011-12-21 22:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <sprudhom@gmail.com>
2011-12-21 18:17 ` Custom title page in org-mode Steve Prud'Homme
2011-12-21 22:15   ` Nick Dokos [this message]
2011-12-21 22:23     ` John Hendy
2011-12-21 23:25       ` Nick Dokos
2011-12-21 23:52         ` Nick Dokos
2011-12-22  2:03         ` John Hendy
2011-12-22  3:01           ` Nick Dokos
2011-12-23 12:54           ` Bastien
2012-10-07 18:34 ` Problem orgmode, beamer and macport Steve Prud'Homme
2012-10-07 22:55   ` Nick Dokos
2012-10-07 23:06     ` Steve Prud'Homme
2012-10-07 23:38       ` Nick Dokos
2012-10-07 23:42         ` Nick Dokos
2012-10-08 17:08           ` cberry

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=8088.1324505746@alphaville.americas.hpqcorp.net \
    --to=nicholas.dokos@hp.com \
    --cc=Emacs-orgmode@gnu.org \
    --cc=sprudhom@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).