Always use $for$ to allow multiple options in LaTeX/ConTeXt/Beamer.

Also makes minor improvements to spacing. Adds indenting option to ConTeXt and multiple header/footer texts.
This commit is contained in:
Andrew Dunning 2015-10-22 13:35:13 -04:00
parent 06fe6706f1
commit e7f2258c89
3 changed files with 56 additions and 38 deletions

View file

@ -21,7 +21,7 @@ $endif$
\setbeamertemplate{caption label separator}{: } \setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg} \setbeamercolor{caption name}{fg=normal text.fg}
$if(fontfamily)$ $if(fontfamily)$
\usepackage[$fontfamilyoptions$]{$fontfamily$} \usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
$else$ $else$
\usepackage{lmodern} \usepackage{lmodern}
$endif$ $endif$
@ -43,20 +43,20 @@ $endif$
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase} \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\newcommand{\euro}{€} \newcommand{\euro}{€}
$if(mainfont)$ $if(mainfont)$
\setmainfont[$mainfontoptions$]{$mainfont$} \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
$endif$ $endif$
$if(sansfont)$ $if(sansfont)$
\setsansfont[$sansfontoptions$]{$sansfont$} \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
$endif$ $endif$
$if(monofont)$ $if(monofont)$
\setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$monofontoptions$$endif$]{$monofont$} \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$}
$endif$ $endif$
$if(mathfont)$ $if(mathfont)$
\setmathfont(Digits,Latin,Greek)[$mathfontoptions$]{$mathfont$} \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
$endif$ $endif$
$if(CJKmainfont)$ $if(CJKmainfont)$
\usepackage{xeCJK} \usepackage{xeCJK}
\setCJKmainfont[$CJKoptions$]{$CJKmainfont$} \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
$endif$ $endif$
\fi \fi
% use upquote if available, for straight quotes in verbatim environments % use upquote if available, for straight quotes in verbatim environments
@ -68,8 +68,10 @@ $endif$
}{} }{}
$if(lang)$ $if(lang)$
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$$sep$,$endfor$,main=$babel-lang$]{babel} \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
$if(babel-newcommands)$
$babel-newcommands$ $babel-newcommands$
$endif$
\else \else
\usepackage{polyglossia} \usepackage{polyglossia}
\setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$} \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}

View file

@ -8,31 +8,38 @@ $endif$
% Enable hyperlinks % Enable hyperlinks
\setupinteraction \setupinteraction
[state=start, [state=start,
$if(title)$
title={$title$},
$endif$
$if(subtitle)$
subtitle={$subtitle$},
$endif$
$if(author)$
author={$for(author)$$author$$sep$; $endfor$},
$endif$
$if(keywords)$
keyword={$for(keywords)$$keywords$$sep$; $endfor$},
$endif$
style=$if(style)$$style$$else$normal$endif$, style=$if(style)$$style$$else$normal$endif$,
color=$if(linkcolor)$$linkcolor$$else$black$endif$, color=$if(linkcolor)$$linkcolor$$else$black$endif$,
contrastcolor=$if(linkcolor)$$linkcolor$$else$black$endif$$if(title)$, contrastcolor=$if(linkcolor)$$linkcolor$$else$black$endif$]
title=$title$$endif$$if(subtitle)$,
subtitle=$subtitle$$endif$$if(author)$,
author=$for(author)$$author$$sep$; $endfor$$endif$$if(keywords)$,
keyword=$keywords$$endif$]
% make chapter, section bookmarks visible when opening document % make chapter, section bookmarks visible when opening document
\placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section] \placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section]
\setupinteractionscreen[option=bookmark] \setupinteractionscreen[option=bookmark]
\setuptagging[state=start] \setuptagging[state=start]
$if(papersize)$ $if(papersize)$
\setuppapersize[$for(papersize)$$papersize$$sep$, \setuppapersize[$for(papersize)$$papersize$$sep$,$endfor$]
$endfor$]
$endif$ $endif$
$if(layout)$ $if(layout)$
\setuplayout[$for(layout)$$layout$$sep$, \setuplayout[$for(layout)$$layout$$sep$,$endfor$]
$endfor$]
$endif$ $endif$
$if(pagenumbering)$ $if(pagenumbering)$
\setuppagenumbering[$for(pagenumbering)$$pagenumbering$$sep$, \setuppagenumbering[$for(pagenumbering)$$pagenumbering$$sep$,$endfor$]
$endfor$]
$endif$ $endif$
\definefontfeature[default][default][protrusion=quality,expansion=quality,onum=yes] % use microtypography % use microtypography
\definefontfeature[default][default][protrusion=quality,expansion=quality,onum=yes,pnum=yes]
\definefontfeature[smallcaps][smallcaps][protrusion=quality,expansion=quality,onum=yes,pnum=yes]
\setupalign[hz,hanging] \setupalign[hz,hanging]
\setupbodyfontenvironment[default][em=italic] % use italic as em, not slanted \setupbodyfontenvironment[default][em=italic] % use italic as em, not slanted
$if(mainfont)$ $if(mainfont)$
@ -48,13 +55,12 @@ $if(mathfont)$
\definefontfamily[mathfont][math][$mathfont$] \definefontfamily[mathfont][math][$mathfont$]
$endif$ $endif$
\setupbodyfont[mainfont$if(fontsize)$,$fontsize$$endif$] \setupbodyfont[mainfont$if(fontsize)$,$fontsize$$endif$]
$if(whitespace)$ \setupwhitespace[$if(whitespace)$$whitespace$$else$medium$endif$]
\setupwhitespace[$whitespace$] $if(indenting)$
$else$ \setupindenting[$for(indenting)$$indenting$$sep$,$endfor$]
\setupwhitespace[medium]
$endif$ $endif$
$if(interlinespace)$ $if(interlinespace)$
\setupinterlinespace[$interlinespace$] \setupinterlinespace[$for(interlinespace)$$interlinespace$$sep$,$endfor$]
$endif$ $endif$
\setuphead[chapter] [style=\tfd,header=empty] \setuphead[chapter] [style=\tfd,header=empty]
@ -65,10 +71,10 @@ $endif$
\setuphead[subsubsubsubsection][style=\it] \setuphead[subsubsubsubsection][style=\it]
$if(headertext)$ $if(headertext)$
\setupheadertexts[$headertext$] \setupheadertexts$for(headertext)$[$headertext$]$endfor$
$endif$ $endif$
$if(footertext)$ $if(footertext)$
\setupfootertexts[$footertext$] \setupfootertexts$for(footertext)$[$footertext$]$endfor$
$endif$ $endif$
$if(number-sections)$ $if(number-sections)$
$else$ $else$

View file

@ -1,6 +1,6 @@
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$} \documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
$if(fontfamily)$ $if(fontfamily)$
\usepackage[$fontfamilyoptions$]{$fontfamily$} \usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
$else$ $else$
\usepackage{lmodern} \usepackage{lmodern}
$endif$ $endif$
@ -26,20 +26,20 @@ $endif$
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase} \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\newcommand{\euro}{€} \newcommand{\euro}{€}
$if(mainfont)$ $if(mainfont)$
\setmainfont[$mainfontoptions$]{$mainfont$} \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
$endif$ $endif$
$if(sansfont)$ $if(sansfont)$
\setsansfont[$sansfontoptions$]{$sansfont$} \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
$endif$ $endif$
$if(monofont)$ $if(monofont)$
\setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$monofontoptions$$endif$]{$monofont$} \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$}
$endif$ $endif$
$if(mathfont)$ $if(mathfont)$
\setmathfont(Digits,Latin,Greek)[$mathfontoptions$]{$mathfont$} \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
$endif$ $endif$
$if(CJKmainfont)$ $if(CJKmainfont)$
\usepackage{xeCJK} \usepackage{xeCJK}
\setCJKmainfont[$CJKoptions$]{$CJKmainfont$} \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
$endif$ $endif$
\fi \fi
% use upquote if available, for straight quotes in verbatim environments % use upquote if available, for straight quotes in verbatim environments
@ -55,11 +55,19 @@ $endif$
\usepackage{hyperref} \usepackage{hyperref}
\PassOptionsToPackage{usenames,dvipsnames}{color} % color is loaded by hyperref \PassOptionsToPackage{usenames,dvipsnames}{color} % color is loaded by hyperref
\hypersetup{breaklinks=true, \hypersetup{breaklinks=true,
unicode=true,$if(title-meta)$ unicode=true,
pdftitle={$title-meta$},$endif$$if(author-meta)$ $if(title-meta)$
pdfauthor={$author-meta$},$endif$$if(subtitle)$ pdftitle={$title-meta$},
pdfsubject={$subtitle$},$endif$$if(keywords)$ $endif$
pdfkeywords={$keywords$},$endif$ $if(author-meta)$
pdfauthor={$author-meta$},
$endif$
$if(subtitle)$
pdfsubject={$subtitle$},
$endif$
$if(keywords)$
pdfkeywords={$for(keywords)$$keywords$$sep$; $endfor$},
$endif$
colorlinks=true, colorlinks=true,
citecolor=$if(citecolor)$$citecolor$$else$black$endif$, citecolor=$if(citecolor)$$citecolor$$else$black$endif$,
urlcolor=$if(urlcolor)$$urlcolor$$else$black$endif$, urlcolor=$if(urlcolor)$$urlcolor$$else$black$endif$,
@ -69,8 +77,10 @@ $endif$
\urlstyle{same} % don't use monospace font for urls \urlstyle{same} % don't use monospace font for urls
$if(lang)$ $if(lang)$
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$$sep$,$endfor$,main=$babel-lang$]{babel} \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
$if(babel-newcommands)$
$babel-newcommands$ $babel-newcommands$
$endif$
\else \else
\usepackage{polyglossia} \usepackage{polyglossia}
\setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$} \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}