Created
July 10, 2020 15:14
-
-
Save Jasonwi/ff624e6d479ef6e0f3b17504e6aecd3a to your computer and use it in GitHub Desktop.
template.latex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Barebone template for use with Zettlr exporting engine | |
% We have to use KOMA classes (scrartcl instead of article and scrreprt instead of report as well as scrbook instead of book) | |
% More info: https://ctan.org/pkg/koma-script?lang=de | |
\documentclass[ | |
$FONT_SIZE$, | |
$if(lang)$ | |
$babel-lang$, | |
$endif$ | |
]{scrartcl} | |
% The following packages are needed for the combined use of Pandoc and XeTeX engine | |
\usepackage{fontspec,xltxtra,xunicode} | |
% These directives are necessary for Pandoc to correctly set the language of the | |
% document. If the user uses XeLaTeX (the default for Zettlr), it will use | |
% polyglossia, else it will use babel. We've simply copied that from the default | |
% template -- thanks to the Pandoc community at this point! | |
$if(lang)$ | |
\ifxetex | |
\usepackage{polyglossia} | |
\setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$} | |
$for(polyglossia-otherlangs)$ | |
\setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$} | |
$endfor$ | |
\else | |
\usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel} | |
\fi | |
$endif$ | |
\usepackage{fontspec} % 允許設定字體 | |
\usepackage{xeCJK} % 分開設置中英文字型 | |
\setCJKmainfont{Source Han Serif SC} % 設定中文字型 | |
\setmainfont{Noto Sans SC} % 設定英文字型 | |
\setromanfont{Noto Sans SC} % 字型 | |
\setmonofont{Courier New} | |
\setsansfont{Noto Sans SC} | |
% Captions for tables and images | |
\usepackage{caption} | |
\captionsetup{format=plain, font=small, labelfont=bf} | |
% This package is needed for better rendering of images (including captions) | |
\usepackage{graphicx} | |
% These packages are needed by pandoc for certain special glyphs, such as the | |
% \square symbol for checkboxes. | |
\usepackage{amssymb,amsmath} | |
% Calc is needed to compute the image width (to prevent up-scaling of small images) | |
\usepackage{calc} | |
% ulem is needed for underlining and strikethrough text commands. | |
% the option "normalem" is needed to preserve _italics_. Without the option, | |
% _italics_ will become underlines, which is not desirable. | |
\usepackage[normalem]{ulem} | |
% Image scaling code from pandoc default.latex template | |
\makeatletter | |
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} | |
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} | |
\makeatother | |
% Scale images if necessary, so that they will not overflow the page | |
% margins by default, and it is still possible to overwrite the defaults | |
% using explicit options in \includegraphics[width, height, ...]{} | |
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} | |
% Now we also have to make sure that the figures Pandoc inserts are positioned | |
% approximately where they are at. Therefore we have to overwrite the | |
% \begin{figure} command a little bit by using the float package: | |
\usepackage{float} | |
\floatplacement{figure}{H} % ensure default position as H (exactly where the figure is in the text) | |
% Needed for pandoc's table generation | |
\usepackage{longtable} | |
\usepackage{booktabs} % For using \midrule and \toprule, whatever they are | |
% Optional packages that Zettlr makes use of | |
% fontspec is used to set the different fonts to the user's whishes | |
%2020/7/10 13:43:50 | |
%\setmainfont{$MAIN_FONT$} | |
%\setsansfont{$SANS_FONT$} | |
% With geometry we can let the user decide on the margin | |
\usepackage{geometry} | |
% Additional options for geometry can be found here: http://texdoc.net/texmf-dist/doc/latex/geometry/geometry.pdf | |
\geometry{verbose,$PAPER_TYPE$,tmargin=$TOP_MARGIN$,bmargin=$BOTTOM_MARGIN$,lmargin=$LEFT_MARGIN$,rmargin=$RIGHT_MARGIN$} | |
% PAGE NUMBERING OPTIONS: https://de.sharelatex.com/learn/Page_numbering | |
\pagenumbering{$PAGE_NUMBERING$} | |
% Line spacing | |
\usepackage{setspace} | |
% Can be a multiple of 1 (i.e. 1.5 for 150 percent) | |
\setstretch{$LINE_SPACING$} | |
% PDF metadata generated by Zettlr or given by the user, also some other URL | |
% options (breaklinks breaks URLs so they aren't ugly) | |
\usepackage[hyphens]{url} % This package breaks links even better | |
\usepackage{hyperref} | |
\hypersetup{ | |
unicode=true, | |
breaklinks=true, | |
colorlinks=true, | |
linkcolor=[rgb]{0.00,0.00,0.00}, | |
urlcolor=[rgb]{0.00,0.00,0.00}, | |
pdftitle={$PDF_TITLE$}, | |
pdfsubject={$PDF_SUBJECT$}, | |
pdfauthor={$PDF_AUTHOR$}, | |
pdfkeywords={$PDF_KEYWORDS$}, | |
pdfproducer={Zettlr with Pandoc and XeLaTeX}, | |
pdfborder={0 0 0} | |
} | |
% The following preconditions are necessary to have Pandoc produce highlighted | |
% code without throwing errors like mad. | |
% \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} | |
\usepackage{color} | |
\usepackage{fancyvrb} | |
% Define the Shaded environment Pandoc uses | |
\newenvironment{Shaded}{}{} | |
% Define the Highlighting environment for Pandoc | |
\DefineShortVerb[commandchars=\\\{\}]{\|} | |
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} | |
% Now some code highlighting commands Pandoc uses | |
\newcommand{\euro}{€} | |
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} | |
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}} | |
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} | |
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} | |
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} | |
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} | |
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} | |
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}} | |
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}} | |
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} | |
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}} | |
\newcommand{\RegionMarkerTok}[1]{{#1}} | |
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} | |
\newcommand{\NormalTok}[1]{{#1}} | |
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{#1}} | |
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} | |
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} | |
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{#1}} | |
\newcommand{\ImportTok}[1]{#1} | |
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{#1}}} | |
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} | |
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} | |
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}} | |
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} | |
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}} | |
\newcommand{\BuiltInTok}[1]{#1} | |
\newcommand{\ExtensionTok}[1]{#1} | |
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{#1}} | |
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{#1}} | |
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} | |
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} | |
% Always use today's date TODO: Nope, let the user decide (for projects) | |
\date{\today} | |
% The following commands must be provided for Pandoc to work correctly. | |
\providecommand{\tightlist}{% | |
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} | |
% The following commands are used by Pandoc if a CSL bibliography is present | |
% to create proper indentation, especially for styles with hanging indentation. | |
$if(csl-refs)$ | |
\newlength{\cslhangindent} | |
\setlength{\cslhangindent}{1.5em} | |
\newenvironment{cslreferences}% | |
{$if(csl-hanging-indent)$\setlength{\parindent}{0pt}% | |
\everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}% | |
{\par} | |
$endif$ | |
\title{$PDF_TITLE$} | |
\author{$PDF_AUTHOR$} | |
\begin{document} | |
% Title page? | |
$TITLEPAGE$ | |
% Generate a table of contents? | |
$GENERATE_TOC$ | |
% LIST OF TABLES? | |
$if(lot)$ | |
\listoftables | |
$endif$ | |
% LIST OF FIGURES? | |
$if(lof)$ | |
\listoffigures | |
$endif$ | |
% BEGIN BODY | |
$body$ | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment