| [comment] |
| Copyright (c) 2010, 2011 Obeo |
| All rights reserved. This program and the accompanying materials |
| are made available under the terms of the Eclipse Public License 1.0 |
| |
| Any license can be applied to the files generated with this template |
| and Acceleo. |
| [/comment] |
| [comment encoding = UTF-8 /] |
| [module latex('http://www.eclipse.org/intent/markup/0.7', 'http://www.eclipse.org/intent/markup/generator/0.7')/] |
| [import org::eclipse::mylyn::docs::intent::markup::gen::queries::latexQueries/] |
| |
| [template public generate(e : Document)] |
| [comment @main /] |
| [file (e.fileName(), false, 'UTF-8')] |
| [e.content->filter(Section)->any(true).toDocument()/] |
| [/file] |
| [/template] |
| |
| [template public toDocument(e : Section)] |
| %% [protected ('preamble')] |
| \documentclass{article} |
| |
| \usepackage{color} |
| \usepackage['['/][']'/]{graphicx} |
| \usepackage{float} |
| \usepackage{amsfonts} |
| \usepackage{hyperref} |
| \hypersetup{ |
| bookmarks=true, % show bookmarks bar? |
| unicode=false, % non-Latin characters in Acrobats bookmarks |
| pdftoolbar=true, % show Acrobats toolbar? |
| pdfmenubar=true, % show Acrobats menu? |
| pdffitwindow=false, % window fit to page when opened |
| pdfstartview={FitH}, % fits the width of the page to the window |
| pdftitle={[title/] }, % title |
| pdfsubject={Subject}, % subject of the document |
| pdfcreator={Creator}, % creator of the document |
| pdfproducer={Producer}, % producer of the document |
| pdfkeywords={keywords}, % list of keywords |
| pdfnewwindow=true, % links in new window |
| colorlinks=true, % false: boxed links; true: colored links |
| linkcolor=black, % color of internal links |
| citecolor=green, % color of links to bibliography |
| filecolor=magenta, % color of file links |
| urlcolor=blue % color of external links |
| } |
| |
| \usepackage{hyperref} |
| \usepackage{graphicx} |
| \usepackage['['/]a4paper[']'/]{geometry} |
| |
| \title{[title.toTex().escapeTex()/]} |
| \author{} |
| |
| %% [/protected] |
| |
| \begin{document} |
| |
| %% [protected ('document start')] |
| |
| \maketitle |
| \tableofcontents |
| |
| %% [/protected] |
| |
| [e.content.toTex()/] |
| |
| [if (not autoRotateImage())] |
| \chapter{Annex : Large figures} |
| \label{large_figures} |
| |
| This chapter includes all the large figures of the document oriented in landscape, more convenient once printed on paper. |
| |
| [largeFiguresAnnex()/] |
| [/if] |
| \end{document} |
| [/template] |
| |
| [template public largeFiguresAnnex (e : Section) ] |
| |
| [for (img : Image | e.eAllContents(Image)->select(hasLandscapeRatio()))] |
| \begin{figure}['['/]H[']'/] |
| \centering |
| \label{large:[img.getImageLocationPath()/]} |
| [if (img.getWidthRatio() > 1.5)] |
| \includegraphics['['/]angle=270, width=350pt[']'/]{[img.getImageLocationPath()/]} |
| [elseif (img.getWidthRatio() > 1.3)] |
| \includegraphics['['/]angle=270, width=400pt[']'/]{[img.getImageLocationPath()/]} |
| [else] |
| \includegraphics['['/]angle=270, width=420pt[']'/]{[img.getImageLocationPath()/]} |
| [/if] |
| \end{figure} |
| [/for] |
| |
| |
| [/template] |
| |
| [template public toTex (elem : OclAny) ] |
| %% not handled yet [elem.eClass().name/] |
| [/template] |
| |
| [template public toTex(e : Entity)] |
| [let decoded : String = e.decode()] |
| [if (decoded = '’')] |
| ' |
| [/if] |
| [/let] |
| [/template] |
| |
| |
| [template public toTex(b : Block) post (trim()) ] |
| [if (b.content->size() > 0)] |
| [b.content.toTex()/] |
| [/if] |
| [/template] |
| |
| [template public toTex(e : SimpleContainer)] |
| [e.content.toTex()/] |
| [/template] |
| |
| [template public toTex(e : Section) ] |
| [if (not e.title.oclIsUndefined())] |
| [if (level = 2)] |
| \chapter{[title.toTex()/]} |
| [elseif (level = 3)] |
| \section{[title.toTex()/]} |
| [elseif (level = 4)] |
| \subsection{[title.toTex()/]} |
| [elseif (level = 5)] |
| \subsubsection{[title.toTex()/]} |
| [elseif (level = 6)] |
| \paragraph{[title.toTex()/]} |
| [/if] |
| [e.content.toTex()/] |
| [/if] |
| [/template] |
| |
| [template public toTex(e : Paragraph) ? (e.attributes->select(a : Annotations | a.CSSClass = 'footnote')->notEmpty()) ] |
| \footnote{[drop(e.content->asSequence(), 1).toTex()->sep(' ')/]} |
| [/template] |
| |
| [template public toTex(e : Paragraph) ] |
| |
| [e.content.toTex()-> sep(' ')/] |
| |
| [/template] |
| |
| [template public toTex(e : Text) ? (e.attributes->select(a : Annotations | a.CSSClass = 'footnote')->isEmpty()) post (trim()) ] |
| [if (not e.data.oclIsUndefined())] |
| [e.format.formatTex()/][e.data.escapeTex()/][for (f : Formatting | e.format)][if (f <> Formatting::none)]} [/if][/for][if (e.lineBreak)] |
| \newline[/if] |
| [/if] |
| [/template] |
| |
| [template public formatTex(value : Formatting) ? (value = Formatting::emphasis)] \emph{[/template] |
| [template public formatTex(value : Formatting) ? (value = Formatting::strong)] \textbf{[/template] |
| [template public formatTex(value : Formatting) ? (value = Formatting::bold)] \textbf{[/template] |
| [template public formatTex(value : Formatting) ? (value = Formatting::italic)] \textit{[/template] |
| [template public formatTex(value : Formatting) ? (value = Formatting::code)] \texttt{[/template] |
| [template public formatTex(value : Formatting) ? (value = Formatting::monospace)] \texttt{[/template] |
| [template public formatTex(value : Formatting) ? (value = Formatting::underlined)] \underline{[/template] |
| [template public formatTex(value : Formatting) ? (value = Formatting::citation)] \textsl{[/template] |
| [template public formatTex(value : Formatting) ? (value = Formatting::subscript)]{[/template] |
| [template public formatTex(value : Formatting) ? (value = Formatting::superscript)]{[/template] |
| |
| [template public toTex(c : Code)] |
| |
| {\small |
| \begin{verbatim} |
| [c.content.toTex().toString().trim()/] |
| \end{verbatim}} |
| |
| [/template] |
| |
| [template public toTex(p : Preformatted)] |
| |
| {\small |
| \begin{verbatim} |
| [p.content.toTex().toString().trim()/] |
| \end{verbatim}} |
| |
| [/template] |
| |
| [template public toTex(p : Quote)] |
| |
| \begin{quote} |
| [p.content.toTex().toString().trim()/] |
| \end{quote} |
| |
| [/template] |
| |
| [template public toTex(l : List) ? (l.listType <> ListType::TABLE_OF_CONTENT) post (trim())] |
| |
| \begin{[l.listEnv()/]} |
| [for (li : ListItem | l.items)] |
| \item [li.toTex()/] |
| [/for] |
| \end{[l.listEnv()/]} |
| |
| [/template] |
| |
| [template public toTex(l : ListItem)] |
| [l.content.toTex()/] |
| [if (not(l.items->isEmpty()) and not(l.items->first().items->isEmpty()))] |
| \begin{[l.items->first().listEnv()/]} |
| [for (li : ListItem | l.items->first().items)] |
| \item [li.toTex()/] |
| [/for] |
| \end{[l.items->first().listEnv()/]} |
| [/if] |
| [/template] |
| |
| [template public toTex(t : Table)] |
| |
| \begin{center} |
| \begin{tabular}{|[for (t.eContents(TableRow)->first().eContents(TableCell))]l|[/for]} |
| \hline |
| [for (r : TableRow | t.eContents(TableRow))] |
| [for (c : TableCell | butLast(r.eContents(TableCell)))][c.toTex()/] & [/for][r.eContents(TableCell)->last().toTex()/] \\ |
| [if (r.eContents(TableCell)->any(c : TableCell | c.isCellHeader))->notEmpty()]\hline\hline[/if] |
| [/for] |
| \hline |
| \end{tabular} |
| \end{center} |
| |
| [/template] |
| |
| [template public toTex(img : Image) ? (not img.exists())] |
| |
| % Image [img.getImageLocationPath()/] is not found |
| [/template] |
| |
| [template public toTex(img : Image) ? (img.exists() and img.eContainer(Table)->size() = 0)] |
| |
| \begin{figure}['['/]H[']'/] |
| \centering |
| [if (hasLandscapeRatio())] |
| [if (autoRotateImage())] |
| \includegraphics['['/]angle=270, width=450pt[']'/]{[img.getImageLocationPath()/]} |
| [else] |
| \includegraphics['['/]width=1\textwidth[']'/]{[img.getImageLocationPath()/]} |
| [/if] |
| [else] |
| \includegraphics['['/]width=[getImageWidth()/]\textwidth[']'/]{[img.getImageLocationPath()/]} |
| [/if] |
| %[protected (img.url)] |
| |
| %[/protected] |
| \end{figure} |
| [if (not autoRotateImage() and hasLandscapeRatio())] |
| \footnote{This figure is also available in landscape mode in annex : \ref{large:[img.getImageLocationPath()/]}.} |
| [/if] |
| [/template] |
| |
| |
| [template public toTex(img : Image) ? (img.exists() and img.eContainer(Table)->size() > 0)] |
| \includegraphics['['/]width=[getImageWidth()/]\textwidth[']'/]{[img.getImageLocationPath()/]} |
| |
| [/template] |
| |
| [template public toTex(link : Link)] |
| \href{[link.hrefOrHashName/]}{[link.name.toTex()/]} |
| [/template] |