Skip to content

Instantly share code, notes, and snippets.

@mjlassila
Last active October 22, 2018 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjlassila/f9083b0bc8f1a20c14bc9754d81b3fef to your computer and use it in GitHub Desktop.
Save mjlassila/f9083b0bc8f1a20c14bc9754d81b3fef to your computer and use it in GitHub Desktop.
Pandoc xelatex.template for Infomaatiotutkimus-journal
\documentclass[11pt,tandh,b5paper,twoside,openright]{memoir}
\usepackage{polyglossia}
\setdefaultlanguage{finnish}
\setmainlanguage{finnish}
\setotherlanguage[variant=american]{english}
\usepackage{hyphenat}
\usepackage{abstract}
\let\newfloat\undefined
\usepackage{floatrow}
\DeclareFloatFont{tiny}{\tiny}% "scriptsize" is defined by floatrow, "tiny" not
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{org-preamble-xelatex}
\usepackage{etoolbox}
\usepackage{setspace}
\usepackage{pgffor}
\usepackage{xstring}
\usepackage{wallpaper}
\usepackage{float}
\usepackage[raggedright]{titlesec}
\usepackage{chngcntr}
\usepackage{hyphenat}
\usepackage{booktabs}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
$if(startpage)$
\cleardoublepage
\setcounter{page}{$startpage$}
$endif$
\usepackage[inline]{enumitem}
\makeatletter
\newcommand*{\@doendeq}{%
\everypar{{\setbox\z@\lastbox}\everypar{}}%
}
\definecolor{citations}{rgb}{0,0,0}
\definecolor{link}{rgb}{0,0,0}
\usepackage{url}
\usepackage{hyperref}
\hypersetup{colorlinks=false,hidelinks,breaklinks}
\usepackage{doi}
\usepackage{microtype}
\hyphenation{YSO-a-si-a-sa-na-eh-do-tuk-sen vuo-si-kir-ja-muo-dos-sa Nop-SA- hank-keen SU-RI-MA KO-TA-tie-to-kan-nas-ta Jul-kai-su-foo-ru-mi tie-to-kan-nas-ta a-si-a-kir-ja-aineis-to-jen OA-mää-ri-tel-mi-en OA-jul-kai-su-jen I-päi-vi-en-kin -ra-hoi-tus-kier-rok-sen OA-man-daat-ti-en hank-ki-mal-la O-me-ka-poh-jai-nen Nos-tal-gis-kon-ser-va-tii-vi-ses-ti lu-vuil-la käs-kyn-hal-ti-ja-hal-lin-to-or-ga-ni-saa-ti-os-sa Vi-pu-nen-tie-to-pal-ve-lus-ta access-jul-ki-lau-su-ma U-TE-LE-hank-kees-sa o-pet-ti am-mat-ti-i-den-ti-tee-tis-sä Jul-kai-su-foo-ru-mi-luo-ki-tuk-si-a alt-met-riik-ka-da-tan ICT-tu-es-sa jat-ko-o-pin-noil-le ta-sa-ar-voi-si-ne tie-teen-a-la-a-na-lyy-siin}
\tolerance=700
\hyphenpenalty=1000
\setlength{\emergencystretch}{3em}
\AfterEndEnvironment{quote}{\ignorespacesafterend\par\noindent\aftergroup\@doendeq}
\makeatother
\setlrmarginsandblock{3.0cm}{2.5cm}{*} % Left and right margin
\setulmarginsandblock{3cm}{3cm}{*} % Upper and lower margin
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\@makesectionhead}{#1}{\hyphenpenalty=10000 #1}{}{}% Patch \chapter
\patchcmd{\@makesectionhead}{#1}{\hyphenpenalty=10000 #1}{}{}% Patch \chapter*
\makeatother
\checkandfixthelayout
\setlength{\bibhang}{11pt}% the hanging indent
\setlength{\bibitemsep}{6pt}% the separation b/w basic items
\setlength{\bibinitsep}{\baselineskip}% insert blank line between different initial letters
\dimen\footins=12in
% \clubpenalty=100
% \widowpenalty=9000
% \displaywidowpenalty=10000
% \brokenpenalty=2991
\setsecheadstyle{\LARGE\bfseries}
\setsubsecheadstyle{\Large\bfseries}
\setsubsubsecheadstyle{\large\bfseries}
\setparaheadstyle{\large\bfseries}
\setsubparaheadstyle{\large\bfseries}
\setbeforesecskip{-2em}
\setbeforesubsecskip{-2em}
\setbeforesubsubsecskip{-2em}
\setaftersecskip{3em}
\setaftersubsecskip{3em}
\setaftersubsubsecskip{3em}
\makepagestyle{inf}
\makeoddhead{inf}{Informaatiotutkimus 3(37)}{}{\scshape\thepage}
\makeevenhead{inf}{\scshape\thepage}{}{Informaatiotutkimus 3(37)}
\makeoddfoot{inf}{}{}{}
\makeevenfoot{inf}{}{}{}
\setlength{\footmarkwidth}{\leftmargin}
\setlength{\footmarksep}{0em}
\footmarkstyle{#1\hfill}
\makeatletter
\def\footnoterule{\kern-8\p@
\hrule \@width 2in \kern 7.6\p@} % the \hrule is .4pt high
\makeatother
\feetatbottom
\raggedbottom
\makepagestyle{myplain}
\makeevenfoot{myplain}{}{}{}
\makeoddfoot{myplain}{}{}{}
\setlength{\abstitleskip}{-\parindent} % make abstract flushleft
\setlength{\absleftindent}{0pt} % make abstract non-indented
\setlength{\absrightindent}{0pt}
$if(section)$
\makeevenhead{empty}{\uppercase{$section$}}{}{}
\makeoddhead{empty}{\uppercase{$section$}}{}{}
\makeevenfoot{empty}{\href{http://creativecommons.org/licenses/by-nc-sa/4.0/}{\tiny{Artikkeli on lisensoitu Creative Commons Nimeä-EiKaupallinen-JaaSamoin 4.0 Kansainvälinen -lisenssillä}}\\\tiny{Pysyvä osoite: \url{$doi$}}}{}{}
\makeoddfoot{empty}{\href{http://creativecommons.org/licenses/by-nc-sa/4.0/}{\tiny{Artikkeli on lisensoitu Creative Commons Nimeä-EiKaupallinen-JaaSamoin 4.0 Kansainvälinen -lisenssillä}}\\\tiny{Pysyvä osoite: \url{$doi$}}}{}{}
$endif$
% \makeevenhead{inf}{\scshape\thepage}{}{Informaatiotutkimus 2(37)}
\makeatletter
\AtEndDocument{%
\ifnum\value{page} > \@ne
\immediate\write\@auxout{\global\let\string\@multipage\relax}%
\fi
}
\newcommand*{\oneormorepages}{%
\ifdefined\@multipage
\thispagestyle{inf}%
\else
\thispagestyle{inf}%
\fi
}
\patchcmd{\maketitle}
{\thispagestyle{title}}%
{\oneormorepages}{}{}
%% Change `plain` to `title` if you are using a `memoir` class
\makeatother
\captionsetup{
labelfont={small},
font={small}
}
\captionsetup[figure]{
name=Kuva
}
\captionsetup[table]{
name=Taulukko
}
% \makeevenhead{kjh}{}{}{\scshape\thepage}
% \makeoddhead{kjh}{}{}{\scshape\thepage}
$if(keywords)$
\newcommand{\keywords}{%
\noindent Asiasanat: $for(keywords)$$keywords$$sep$; $endfor$ }
$endif$
$if(listings)$
\usepackage{listings}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=r,basicstyle=\small\ttfamily}}{}
$endif$
$if(highlighting-macros)$
$highlighting-macros$
$endif$
$if(verbatim-in-note)$
\usepackage{fancyvrb}
$endif$
$if(tables)$
\floatsetup[table]{font=tiny}
$endif$
$if(graphics)$
\usepackage{graphicx}
% We will generate all images so they have a width \maxwidth. This means
% that they will get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
\makeatletter
% \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
%\else\Gin@nat@width\fi}
%\makeatother
%\let\Oldincludegraphics\includegraphics
%\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
$endif$
$for(header-includes)$
$header-includes$
$endfor$
$if(title)$
\title{$title$}
$endif$
%\author{$for(author)$$author$$sep$\\$endfor$}
\begin{Spacing}{1}
\author{$for(author)$\large $author.name$\vspace{0.025in} \newline\small\emph{$author.affiliation$}\newline\scriptsize \url{$author.email$}\newline\scriptsize \url{$author.orcid$}\vspace*{0.1in}\newline\normalsize $sep$ \and $endfor$}
\end{Spacing}
%\author{$for(author)$$author.name$ ($author.affiliation$)$sep$ \and $endfor$}
\date{}
\newcommand\blfootnote[1]{%
\begingroup
\renewcommand\thefootnote{}\footnote{#1}%
\addtocounter{footnote}{-1}%
\endgroup
}
\begin{document}
\defaultfontfeatures{Ligatures=Common}
\chapterstyle{article-4}
\setkeys{Gin}{width=1\textwidth}
\setmainfont[Mapping=tex-text,Numbers=OldStyle]{Minion Pro}
\setsansfont[Mapping=tex-text]{Minion Pro}
\setmonofont[Mapping=tex-text,Scale=0.8]{Consolas}
\patchcmd{\bibliography}{\clubpenalty4000}{\clubpenalty10000}{}{}
\patchcmd{\bibliography}{\widowpenalty4000}{\clubpenalty10000}{}{}
% \published{$date$.}
$if(title)$
\maketitle
\thispagestyle{empty}
$endif$
$if(toc)$
{
\hypersetup{linkcolor=black}
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
}
$endif$
$if(compress)$
\vspace{-2.1cm}
$endif$
$if(compressabstract)$
\vspace{-1.2cm}
$endif$
$if(abstract)$
\begin{Spacing}{1}
\begin{abstract}
\noindent $abstract$
\end{abstract}
\end{Spacing}
$if(compressmore)$
\vspace{-1.5cm}
$endif$
$endif$
$if(keywords)$
\scriptsize
\keywords
\normalsize
$endif$
$if(peerreview)$
% \begin{figure}[H]
\noindent \includegraphics[width=2.5cm,height=1cm]{/Users/majulass/Documents/2018/informaatiotutkimus-vuosikirja/VA_tunnus_tekstein_iso.jpg}
%\end{figure}
$endif$
\pagestyle{inf}
\section{}
$body$
$if(natbib)$
$if(biblio-files)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{Bibliography}
$else$
\renewcommand\refname{References}
$endif$
$endif$
\bibliography{$biblio-files$}
$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=References]$endif$
$endif$
$for(include-after)$
$include-after$
$endfor$
\makeatother
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment