CB100

Notas, resueltos y tps de la materia Algoritmos y Estructuras de Datos
Index Commits Files Refs README
   1 % \documentclass[14pt]{extarticle}
   2 
   3 % page setup
   4 % \usepackage[a4paper,
   5 %             top=2.5cm,
   6 %             bottom=2.5cm,
   7 %             left=2.00cm,
   8 %             right=2.00cm,
   9 %             bmargin=2.50cm]{geometry}
  10 \usepackage[a4paper,
  11             top=2.25cm,
  12             left=2.00cm,
  13             right=2.00cm,
  14             bottom=2.00cm,
  15             bmargin=2.25cm]{geometry}
  16 
  17 \usepackage{titlesec}
  18 \usepackage{fontspec}
  19 \setmainfont{Helvetica}
  20 
  21 % right pointing hand
  22 \usepackage{utfsym}
  23 
  24 % make pictures caption font bold and small
  25 \usepackage[font={footnotesize,bf}]{caption}
  26 \usepackage{subcaption}
  27 
  28 % inline code (backticks in md)
  29 \linespread{1.10}
  30 \definecolor{bgcolor}{HTML}{e0e0e0}
  31 \let\oldtexttt\texttt
  32 
  33 \renewcommand{\texttt}[1]{
  34     \colorbox{bgcolor}{\oldtexttt{#1}}
  35 }
  36 
  37 % change boldfont bold to extrabold
  38 % \setmainfont[
  39 %  BoldFont={Inter-ExtraBold}
  40 % ]{Inter}
  41 
  42 % change regular font to light font
  43 % \setmainfont{Inter light}
  44 
  45 \newfontfamily\titlefont{Inter}[
  46 UprightFont     =   *-Regular,
  47 BoldFont        =   *-ExtraBold,
  48 Scale           =   0.90
  49 ]
  50 
  51 \newfontfamily\sectionsfont{Inter}[
  52 UprightFont     =   *-Regular,
  53 BoldFont        =   *-Bold,
  54 ]
  55 
  56 \setmathfont[Scale=1.05]{Fira Math}
  57 
  58 \usepackage{xcolor}
  59 \definecolor{ugrey}{HTML}{333333}
  60 
  61 \titleformat{\section}
  62 {\color{ugrey}\titlefont\Large\bfseries}
  63 {\color{ugrey}}
  64 {0em}
  65 {}
  66 
  67 \titleformat{\subsection}
  68 {\color{ugrey}\sectionsfont\large\bfseries}
  69 {\color{ugrey}}
  70 {0em}
  71 {}
  72 
  73 \titleformat{\subsubsection}
  74 {\color{ugrey}\sectionsfont\bfseries}
  75 {\color{ugrey}}
  76 {0em}
  77 {}
  78 
  79 \titleformat{\paragraph}
  80 {\color{ugrey}\sectionsfont\bfseries}
  81 {\color{ugrey}\theparagraph}
  82 {0em}
  83 {}
  84 
  85 \titleformat{\subparagraph}
  86 {\color{ugrey}\normalfont\bfseries}
  87 {\color{ugrey}\theparagraph}
  88 {0em}
  89 {}
  90 
  91 % spacing: how to read {12pt plus 4pt minus 2pt}
  92 %       12pt is what we would like the spacing to be
  93 %       plus 4pt means that TeX can stretch it by at most 4pt
  94 %       minus 2pt means that TeX can shrink it by at most 2pt
  95 %
  96 % \titlespacing{command}{left spacing}{before spacing}{after spacing}[right]
  97 
  98 \titlespacing*{\section}
  99 {0pt}{2ex plus 1ex minus .2ex}{1.75ex plus .2ex}
 100 
 101 \titlespacing*{\subsection}
 102 {0pt}{1.75ex plus 1ex minus .2ex}{1.5ex plus .2ex}
 103 
 104 \titlespacing*{\subsubsection}
 105 {0pt}{1.5ex plus 1ex minus .2ex}{1.25ex plus .2ex}
 106 
 107 \titlespacing*{\paragraph}
 108 {0pt}{1.5ex plus 1ex minus .2ex}{1.0ex plus .2ex}
 109 
 110 \titlespacing*{\subparagraph}
 111 {0pt}{1.25ex plus 1ex minus .2ex}{1.0ex plus .2ex}
 112 
 113 % spacing between formulas and text
 114 % \usepackage[nodisplayskipstretch]{setspace}
 115 % \setstretch{1.20}
 116 
 117 \setlength{\abovedisplayskip}{0pt}
 118 \setlength{\belowdisplayskip}{0pt}
 119 
 120 \setlength{\abovedisplayshortskip}{0pt}
 121 \setlength{\belowdisplayshortskip}{0pt}
 122 
 123 \setlength{\belowdisplayshortskip}{\belowdisplayskip}
 124 
 125 \setlength{\baselineskip}{0pt}
 126 
 127 % \usepackage{setspace}
 128 % \setstretch{1.25}
 129 
 130 % \renewcommand{\figurename}{Fig.}
 131 
 132 \usepackage{caption}
 133 \captionsetup{font=normalsize, font=bf, labelfont=bf}
 134 \captionsetup[sub]{font=small,labelfont=md}
 135 
 136 \renewcommand\thesubfigure{\arabic{subfigure}}
 137 
 138 \renewcommand{\figurename}{Figura}
 139 \renewcommand{\tablename}{Tabla}
 140 
 141 % \renewcommand{\contentsname}{Índice}
 142 \renewcommand\contentsname{\vspace*{-45pt}}
 143 
 144 % TOC dots separation
 145 % \renewcommand{\cftdotsep}{10}
 146 
 147 % \setlength{\cftsecindent}{0pt}% Remove indent for \section
 148 % \setlength{\cftsubsecindent}{5pt}% Remove indent for \subsection
 149 % \setlength{\cftsubsubsecindent}{0pt}% Remove indent for \subsubsec
 150 
 151 \setcounter{tocdepth}{4}
 152 
 153 \usepackage{titling}
 154 \renewcommand{\maketitle}{ 
 155     \begin{flushleft}
 156     {\bfseries\Huge\thetitle}
 157     \vspace{1mm}
 158     \end{flushleft}
 159     % \thispagestyle{empty}
 160 }
 161 
 162 % remove the page number from all the pages that the TOC occupies
 163 % \addtocontents{toc}{\protect\thispagestyle{empty}}
 164 
 165 % add page break after TOC set it to page number 1
 166 \let\oldtableofcontents\tableofcontents % remember the definition
 167 \renewcommand\tableofcontents{
 168     \oldtableofcontents % use the standard toc
 169     \thispagestyle{empty}
 170     \pagebreak
 171     \setcounter{page}{1}
 172 }
 173 
 174 % Set text color for all document
 175 % \color{ugrey}
 176 
 177 \usepackage[titles]{tocloft}
 178 \renewcommand{\cftdotsep}{1.5}
 179 \renewcommand{\cftsetpnumwidth}{1.5}
 180 \renewcommand{\cftsetrmarg}{1.5}
 181 
 182 \usepackage{float}
 183 \makeatletter
 184 \def\fps@figure{H}
 185 \makeatother
 186 
 187 % nicer chemical figures
 188 \usepackage{chemfig}
 189 
 190 % change style of quote, see also https://tex.stackexchange.com/a/436253/114857
 191 \usepackage[most]{tcolorbox}
 192 
 193 
 194 \definecolor{linequote}{RGB}{224,215,188}
 195 \definecolor{bordercolor}{RGB}{221,221,221}
 196 % \definecolor{backquote}{RGB}{249,245,233}
 197 \definecolor{backquote}{RGB}{245,245,245}
 198 
 199 % change left border: https://tex.stackexchange.com/a/475716/114857
 200 % change left margin: https://tex.stackexchange.com/a/457936/114857
 201 \newtcolorbox{myquote}[1][]{%
 202     enhanced,
 203     breakable,
 204     size=minimal,
 205     left=8pt,
 206     top=8pt,
 207     bottom=8pt,
 208     right=8pt,
 209     boxrule=1pt,
 210     sharp corners=all,
 211     colback=backquote,
 212     colframe=black,
 213     #1}
 214 
 215 % redefine quote environment to use the myquote environment, see
 216 % https://tex.stackexchange.com/a/337587/114857
 217 \renewenvironment{quote}{\begin{myquote}}{\end{myquote}}
 218 
 219 % better fractions
 220 \usepackage{nicefrac,xfrac}
 221 
 222 % surround footnotes number with square brackets and always use numbers (even
 223 % inside quoted text)
 224 % https://www.overleaf.com/learn/latex/Footnotes
 225 \renewcommand*{\thefootnote}{\ [\arabic{footnote}]\ }
 226 \renewcommand*{\thempfootnote}{\ [\arabic{mpfootnote}]\ }
 227 
 228 % space between text and footer
 229 \setlength\footskip{38pt}
 230 \setlength{\skip\footins}{12pt}
 231 
 232 % align first letter of all the lines in the footnotes
 233 \usepackage[bottomfloats,belowfloats,hang]{footmisc}
 234 \setlength{\footnotemargin}{1em}
 235 
 236 \newcommand{\unit}[2]{\nicefrac{#1}{#2}}
 237 
 238 \usepackage{enumitem}
 239 \usepackage{amsfonts}
 240 
 241 \setlist[itemize,1]{label=$\bullet$}
 242 \setlist[itemize,2]{label=$\textopenbullet$}
 243 
 244 \usepackage{tabularx}
 245 \usepackage{multirow} % Required for multirows
 246 \usepackage{colortbl}
 247 
 248 % Reduce space around displayed equations safely
 249 \makeatletter
 250 \setlength{\jot}{8pt} % valor por defecto es 3pt aproximadamente
 251 \makeatother
 252 
 253 \usepackage{multicol}
 254 \setlength{\columnsep}{12pt}
 255 
 256 % Delay start of two-column layout
 257 \AtBeginDocument{
 258   % Nothing here, let Pandoc insert the title normally
 259 }
 260 
 261 % Begin multicols after title
 262 \usepackage{etoolbox}
 263 \pretocmd{\maketitle}{\clearpage\begin{multicols*}{2}}{}{}
 264 \AtEndDocument{
 265   \end{multicols*}
 266 }
 267 
 268 \usepackage{enumitem}
 269 
 270 \setlist[enumerate]{
 271   leftmargin=0pt,     % no global indentation
 272   labelindent=0pt,    % label aligned with margin
 273   itemindent=5pt,     % no extra indent
 274   labelwidth=0pt,     % label takes no reserved space
 275   align=left          % make wrapped lines align with the left edge, not number
 276 }
 277 
 278 \usepackage[spanish]{babel}
 279 \binoppenalty=10000 
 280 \relpenalty=10000