md2pdf

pandoc wrapper to convert markdown to pdf
Index Commits Files Refs README
style.tex (5058B)
   1 % \documentclass[14pt]{extarticle}
   2 
   3 % page setup
   4 \usepackage[a4paper,
   5             top=1.5cm,
   6             bottom=1.5cm,
   7             left=1.25cm,
   8             right=1.25cm,
   9             bmargin=1.5cm]{geometry}
  10 
  11 \usepackage{titlesec}
  12 \usepackage{fontspec}
  13 
  14 % make pictures caption font bold and small
  15 \usepackage[font={footnotesize,bf}]{caption}
  16 
  17 % inline code (backticks in md)
  18 \linespread{1.10}
  19 \definecolor{bgcolor}{HTML}{e0e0e0}
  20 \let\oldtexttt\texttt
  21 
  22 \renewcommand{\texttt}[1]{
  23     \colorbox{bgcolor}{\oldtexttt{#1}}
  24 }
  25 
  26 % change boldfont bold to extrabold
  27 % \setmainfont[
  28 %  BoldFont={Inter-ExtraBold}
  29 % ]{Inter}
  30 
  31 % change regular font to light font
  32 % \setmainfont{Inter light}
  33 
  34 \newfontfamily\titlefont{Inter}[
  35 UprightFont     =   *-Regular,
  36 BoldFont        =   *-ExtraBold,
  37 Scale           =   1.0
  38 ]
  39 
  40 \newfontfamily\sectionsfont{Inter}[
  41 UprightFont     =   *-Regular,
  42 BoldFont        =   *-Bold,
  43 ]
  44 
  45 \setmathfont{Fira Math}
  46 
  47 \usepackage{xcolor}
  48 \definecolor{ugrey}{HTML}{333333}
  49 
  50 \titleformat{\section}
  51 {\color{ugrey}\titlefont\LARGE\bfseries}
  52 {\color{ugrey}}
  53 {0em}
  54 {}
  55 
  56 \titleformat{\subsection}
  57 {\color{ugrey}\sectionsfont\Large\bfseries}
  58 {\color{ugrey}}
  59 {0em}
  60 {}
  61 
  62 \titleformat{\subsubsection}
  63 {\color{ugrey}\sectionsfont\large\bfseries}
  64 {\color{ugrey}}
  65 {0em}
  66 {}
  67 
  68 \titleformat{\paragraph}
  69 {\color{ugrey}\sectionsfont\bfseries}
  70 {\color{ugrey}\theparagraph}
  71 {0em}
  72 {}
  73 
  74 \titleformat{\subparagraph}
  75 {\color{ugrey}\normalfont\bfseries}
  76 {\color{ugrey}\theparagraph}
  77 {0em}
  78 {}
  79 
  80 % spacing: how to read {12pt plus 4pt minus 2pt}
  81 %       12pt is what we would like the spacing to be
  82 %       plus 4pt means that TeX can stretch it by at most 4pt
  83 %       minus 2pt means that TeX can shrink it by at most 2pt
  84 %
  85 % \titlespacing{command}{left spacing}{before spacing}{after spacing}[right]
  86 
  87 \titlespacing*{\section}
  88 {0pt}{2ex plus 1ex minus .2ex}{1.75ex plus .2ex}
  89 
  90 \titlespacing*{\subsection}
  91 {0pt}{1.75ex plus 1ex minus .2ex}{1.5ex plus .2ex}
  92 
  93 \titlespacing*{\subsubsection}
  94 {0pt}{1.5ex plus 1ex minus .2ex}{1.25ex plus .2ex}
  95 
  96 \titlespacing*{\paragraph}
  97 {0pt}{1.5ex plus 1ex minus .2ex}{1.0ex plus .2ex}
  98 
  99 \titlespacing*{\subparagraph}
 100 {0pt}{1.25ex plus 1ex minus .2ex}{1.0ex plus .2ex}
 101 
 102 % spacing between formulas and text
 103 \setlength{\abovedisplayskip}{5pt}
 104 \setlength{\belowdisplayskip}{2pt}
 105 
 106 \setlength{\abovedisplayshortskip}{9pt}
 107 \setlength{\belowdisplayshortskip}{2pt}
 108 
 109 \setlength{\belowdisplayshortskip}{\belowdisplayskip}
 110 
 111 \setlength{\baselineskip}{10pt}
 112 
 113 % \usepackage{setspace}
 114 % \setstretch{1.25}
 115 
 116 % \renewcommand{\figurename}{Fig.}
 117 
 118 \usepackage{caption}
 119 \captionsetup{labelformat=empty}
 120 
 121 % \renewcommand{\contentsname}{Índice}
 122 \renewcommand\contentsname{\vspace*{-45pt}}
 123 
 124 % TOC dots separation
 125 % \renewcommand{\cftdotsep}{10}
 126 
 127 % \setlength{\cftsecindent}{0pt}% Remove indent for \section
 128 % \setlength{\cftsubsecindent}{5pt}% Remove indent for \subsection
 129 % \setlength{\cftsubsubsecindent}{0pt}% Remove indent for \subsubsec
 130 
 131 \setcounter{tocdepth}{4}
 132 
 133 \usepackage{titling}
 134 \renewcommand{\maketitle}{ 
 135     \begin{flushleft}
 136     {\bfseries\Huge\thetitle}
 137     \vspace{1mm}
 138     \end{flushleft}
 139     \thispagestyle{empty}
 140 }
 141 
 142 % remove the page number from all the pages that the TOC occupies
 143 \addtocontents{toc}{\protect\thispagestyle{empty}}
 144 
 145 % add page break after TOC set it to page number 1
 146 \let\oldtableofcontents\tableofcontents % remember the definition
 147 \renewcommand\tableofcontents{
 148     \oldtableofcontents % use the standard toc
 149     \thispagestyle{empty}
 150     \pagebreak
 151     \setcounter{page}{1}
 152 }
 153 
 154 % Set text color for all document
 155 % \color{ugrey}
 156 
 157 \usepackage[titles]{tocloft}
 158 \renewcommand{\cftdotsep}{1.5}
 159 \renewcommand{\cftsetpnumwidth}{1.5}
 160 \renewcommand{\cftsetrmarg}{1.5}
 161 
 162 \usepackage{float}
 163 \makeatletter
 164 \def\fps@figure{H}
 165 \makeatother
 166 
 167 % nicer chemical figures
 168 \usepackage{chemfig}
 169 
 170 % change style of quote, see also https://tex.stackexchange.com/a/436253/114857
 171 \usepackage[most]{tcolorbox}
 172 
 173 
 174 \definecolor{linequote}{RGB}{224,215,188}
 175 \definecolor{bordercolor}{RGB}{221,221,221}
 176 % \definecolor{backquote}{RGB}{249,245,233}
 177 \definecolor{backquote}{RGB}{230,230,230}
 178 
 179 % change left border: https://tex.stackexchange.com/a/475716/114857
 180 % change left margin: https://tex.stackexchange.com/a/457936/114857
 181 \newtcolorbox{myquote}[1][]{%
 182     enhanced,
 183     breakable,
 184     size=minimal,
 185     left=12pt,
 186     top=12pt,
 187     bottom=12pt,
 188     right=12pt,
 189     boxrule=1pt,
 190     sharp corners=all,
 191     colback=backquote,
 192     colframe=black,
 193     #1}
 194 
 195 % redefine quote environment to use the myquote environment, see
 196 % https://tex.stackexchange.com/a/337587/114857
 197 \renewenvironment{quote}{\begin{myquote}}{\end{myquote}}
 198 
 199 % better fractions
 200 \usepackage{nicefrac,xfrac}
 201 
 202 % surround footnotes number with square brackets and always use numbers (even
 203 % inside quoted text)
 204 % https://www.overleaf.com/learn/latex/Footnotes
 205 \renewcommand*{\thefootnote}{\ [\arabic{footnote}]\ }
 206 \renewcommand*{\thempfootnote}{\ [\arabic{mpfootnote}]\ }
 207 
 208 % space between text and footer
 209 \setlength\footskip{25pt}
 210 \setlength{\skip\footins}{12pt}
 211 
 212 % align first letter of all the lines in the footnotes
 213 \usepackage[bottomfloats,belowfloats,hang]{footmisc}
 214 \setlength{\footnotemargin}{1em}