mirror of
https://github.com/lise-henry/crowbook
synced 2024-05-28 05:46:23 +02:00
269 lines
6.1 KiB
TeX
269 lines
6.1 KiB
TeX
\documentclass<# if has_tex_size #>[<<tex_size>>pt]<# endif #>{<<class>>}
|
||
|
||
%% Package inclusion
|
||
<# if xelatex #>
|
||
% Unicode support if xelatex is used
|
||
\usepackage{fontspec}
|
||
\usepackage{xunicode}
|
||
<# else #>
|
||
% Unicode support if xelatex is not used
|
||
\usepackage[T1]{fontenc}
|
||
\usepackage[utf8]{inputenc}
|
||
|
||
% Even with inputenc, not all unicode chars are recognized when not using xelatex. This a
|
||
% listof some I stumbled upon and manually added to fix
|
||
\usepackage{newunicodechar}
|
||
\newunicodechar{ }{ } % thin non breaking space
|
||
\newunicodechar{°}{$^{\circ}$}
|
||
% Force LaTeX not to overflow page e.g. when there is long words
|
||
% (e.g. filenames, urls, ...). The result is not necesarily very
|
||
% beautiful, though, but at least it's readable.
|
||
\setlength\emergencystretch{.5\textwidth}
|
||
<# endif #>
|
||
|
||
\usepackage[<<tex_lang>>]{babel} % Language support
|
||
\usepackage{fancyhdr} % Headers
|
||
|
||
% Allows hyphenatations in \texttt
|
||
\usepackage[htt]{hyphenat}
|
||
|
||
<# if use_strikethrough #>
|
||
% Only included if strikethrough is used in the document
|
||
\usepackage[normalem]{ulem}
|
||
<# endif #>
|
||
<# if use_taskitem #>
|
||
\usepackage{amssymb}
|
||
<# endif #>
|
||
% Set hyperlinks and metadata
|
||
\usepackage[colorlinks=true,breaklinks=true,hypertexnames=false]{hyperref}
|
||
\hypersetup{pdfauthor={<<author>>},
|
||
pdftitle={<<title>>},
|
||
pdfsubject={<<description>>}
|
||
}
|
||
<# if xelatex #>
|
||
<# else #>
|
||
\usepackage[anythingbreaks]{breakurl}
|
||
<# endif #>
|
||
|
||
|
||
<# if initials #>
|
||
% Only included if use_initials is set to true
|
||
\usepackage{lettrine}
|
||
<# endif #>
|
||
|
||
<# if stdpage #>
|
||
% Only included if the stdpage option is set to true
|
||
\usepackage[<<papersize>>]{geometry}
|
||
\usepackage[hyphen=false, parskip]{stdpage}
|
||
<# else #>
|
||
% Included if the stdpage option if set to false
|
||
\usepackage[<<papersize>>, top=<<margin_top>>, bottom=<<margin_bottom>>,
|
||
left=<<margin_left>>,right=<<margin_right>>]{geometry} % Set dimensions/margins of the parge
|
||
<# endif #>
|
||
|
||
|
||
\makeatletter
|
||
\date{<<date>>}
|
||
|
||
<# if not stdpage #>
|
||
<# if book #>
|
||
% Redefine the \maketitle command, only for book class (not used if stdpage option is set to true)
|
||
\renewcommand{\maketitle}{
|
||
% First page with only the title
|
||
\thispagestyle{empty}
|
||
\vspace*{\stretch{1}}
|
||
|
||
\begin{center}
|
||
{\Huge \@title \\[5mm]}
|
||
\end{center}
|
||
\vspace*{\stretch{2}}
|
||
|
||
\newpage
|
||
% Empty left page
|
||
\thispagestyle{empty}
|
||
\cleardoublepage
|
||
|
||
% Main title page, with author, title, subtitle, date
|
||
\begin{center}
|
||
\thispagestyle{empty}
|
||
\vspace*{\baselineskip}
|
||
\rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt}
|
||
\rule{\textwidth}{0.4pt}\\[\baselineskip]
|
||
|
||
{\Huge\scshape \@title \\[5mm]}
|
||
{\Large <<subtitle>>}
|
||
|
||
\rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt}
|
||
\rule{\textwidth}{1.6pt}\\[\baselineskip]
|
||
|
||
\vspace*{4\baselineskip}
|
||
|
||
{\Large \@author}
|
||
<# if has_autograph #>
|
||
|
||
\vspace*{10\baselineskip}
|
||
|
||
<<autograph>>
|
||
<# endif #>
|
||
\vfill
|
||
<# if has_date #>\@date<# endif #>
|
||
\end{center}
|
||
|
||
\pagebreak
|
||
\newpage
|
||
% Copyright page with author, version, and license
|
||
\thispagestyle{empty}
|
||
\null\vfill
|
||
\noindent
|
||
\begin{center}
|
||
{\emph{\@title}<#if has_version #>{, <<version>>}<# endif #><# if has_author #>, © \@author<# endif #>.\\[5mm]}
|
||
<# if has_license #>{<<license>>\\[5mm]}<# endif #>
|
||
\end{center}
|
||
\pagebreak
|
||
\newpage
|
||
}
|
||
<# endif #>
|
||
|
||
|
||
% Redefine headers
|
||
\pagestyle{fancy}
|
||
\fancyhead{}
|
||
\fancyhead[CO,CE]{\thepage}
|
||
\fancyfoot{}
|
||
|
||
|
||
<# endif #>
|
||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||
% Command and environment definitions
|
||
%
|
||
% Here, commands are defined for all Markdown element (even if some
|
||
% of them do nothing in this template).
|
||
%
|
||
% If you want to change the rendering of some elements, this is probably
|
||
% what you should modify.
|
||
%
|
||
% Note that elements that already have a LaTeX semantic equivalent aren't redefined
|
||
% : if you want to redefine headers, you'll have to renew \chapter, \section, \subsection,
|
||
% ..., commands. If you want to change how emphasis is displayed, you'll have to renew
|
||
% the \emph command, for list the itemize one, for ordered list the enumerate one,
|
||
% for super/subscript the \textsuper/subscript ones.
|
||
%
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||
|
||
% Strong
|
||
\newcommand\mdstrong[1]{\textbf{#1}}
|
||
|
||
% Code
|
||
\newcommand\mdcode[1]{\texttt{#1}}
|
||
|
||
% Rule
|
||
% Default impl : (displays centered asterisks)
|
||
\newcommand\mdrule{
|
||
\nopagebreak
|
||
{\vskip 1em}
|
||
\nopagebreak
|
||
\begin{center}
|
||
***
|
||
\end{center}
|
||
\nopagebreak
|
||
{\vskip 1em}
|
||
\nopagebreak
|
||
}
|
||
|
||
% Hardbreak
|
||
\newcommand\mdhardbreak{\\}
|
||
|
||
% Block quote$
|
||
\newenvironment{mdblockquote}{%
|
||
\begin{quotation}
|
||
\itshape
|
||
}{%
|
||
\end{quotation}
|
||
}
|
||
|
||
|
||
% Code block
|
||
%
|
||
% Only used if syntect is used for syntax highlighting is used, else
|
||
% the spverbatim environment is preferred.
|
||
<# if use_codeblocks #> % This part is only included if document contains code blocks
|
||
\usepackage{spverbatim}
|
||
\usepackage{color}
|
||
\usepackage[
|
||
topline=false,
|
||
rightline=false,
|
||
bottomline=false]{mdframed}
|
||
|
||
\newenvironment{mdcodeblock}{%
|
||
\begin{mdframed}
|
||
}{%
|
||
\end{mdframed}
|
||
}
|
||
<# endif #>
|
||
|
||
<# if use_images #>
|
||
% Only included if document contains images
|
||
\usepackage{graphicx}
|
||
|
||
% Standalone image
|
||
% (an image alone in its paragraph)
|
||
\newcommand\mdstandaloneimage[1]{
|
||
\begin{center}
|
||
\includegraphics[width=0.8\linewidth]{#1}
|
||
\end{center}
|
||
}
|
||
|
||
% Image
|
||
% (an image embedded in a pagraph or other element)
|
||
\newcommand\mdimage[1]{\includegraphics{#1}}
|
||
<# endif #>
|
||
|
||
<# if use_tables #>
|
||
% Only included if document contains tables
|
||
\usepackage{tabularx}
|
||
|
||
% Table environment
|
||
% Crowbook currently always insert \hline at beginning and end of the table
|
||
|
||
|
||
\newenvironment{mdtable}[1]{%
|
||
\center
|
||
\tabularx{\textwidth}{#1}
|
||
\hline
|
||
}{%
|
||
\endtabularx
|
||
\endcenter
|
||
}
|
||
<# endif #>
|
||
|
||
<<additional_code>>
|
||
|
||
\makeatother
|
||
|
||
\title{<<title>>}
|
||
\author{<<author>>}
|
||
|
||
\begin{document}
|
||
|
||
% Redefine chapter and part names if they needs to be
|
||
% Needs to be after \begin{document} because babel
|
||
<# if chapter_name #>
|
||
\makeatletter
|
||
\renewcommand{\@chapapp}{<<chapter_name>>}
|
||
\makeatother
|
||
<# endif #>
|
||
|
||
<# if part_name #>
|
||
\renewcommand{\partname}{<<part_name>>}
|
||
<# endif #>
|
||
|
||
|
||
<# if tex_title #>
|
||
\maketitle
|
||
<# endif #>
|
||
|
||
<<content>>
|
||
|
||
\end{document}
|