oscarbenedito | 6bc418b | 2019-09-20 13:28:57 +0200 | [diff] [blame] | 1 | % \iffalse meta-comment |
| 2 | % |
| 3 | %% apuntsfme.dtx |
| 4 | %% Copyright 2019 ApuntsFME |
| 5 | % |
| 6 | % This work may be distributed and/or modified under the |
| 7 | % conditions of the LaTeX Project Public License, either version 1.3 |
| 8 | % of this license or (at your option) any later version. |
| 9 | % The latest version of this license is in |
| 10 | % http://www.latex-project.org/lppl.txt |
| 11 | % and version 1.3 or later is part of all distributions of LaTeX |
| 12 | % version 2005/12/01 or later. |
| 13 | % |
| 14 | % This work has the LPPL maintenance status `maintained'. |
| 15 | % |
| 16 | % The Current Maintainer of this work is the ApuntsFME organization. |
| 17 | % |
| 18 | % This work consists of the files apuntsfme.dtx and apuntsfme.ins |
| 19 | % and the derived file apuntsfme.sty. |
| 20 | % |
| 21 | % \fi |
| 22 | % |
| 23 | % \iffalse |
| 24 | %<*driver> |
| 25 | \ProvidesFile{apuntsfme.dtx} |
| 26 | %</driver> |
| 27 | % |
| 28 | %<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01] |
| 29 | %<package>\ProvidesPackage{apuntsfme}[2019/07/08 v1.o .dtx apuntsfme file] |
| 30 | % |
| 31 | %<class>\NeedsTeXFormat{LaTeX2e}[2005/12/01] |
| 32 | %<class>\ProvidesClass{notes}[2019/10/12 v1.0 class for taking notes in class] |
| 33 | % |
| 34 | %<*driver> |
| 35 | \documentclass{ltxdoc} |
| 36 | \usepackage{apuntsfme} |
| 37 | \usepackage{hyperref} |
| 38 | \usepackage{csquotes} |
| 39 | \EnableCrossrefs |
| 40 | \CodelineIndex |
| 41 | \RecordChanges |
| 42 | \begin{document} |
| 43 | \DocInput{apuntsfme.dtx} |
| 44 | \end{document} |
| 45 | %</driver> |
| 46 | % \fi |
| 47 | % |
| 48 | % \CheckSum{175} |
| 49 | % |
| 50 | % \CharacterTable |
| 51 | % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 52 | % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 53 | % Digits \0\1\2\3\4\5\6\7\8\9 |
| 54 | % Exclamation \! Double quote \" Hash (number) \# |
| 55 | % Dollar \$ Percent \% Ampersand \& |
| 56 | % Acute accent \' Left paren \( Right paren \) |
| 57 | % Asterisk \* Plus \+ Comma \, |
| 58 | % Minus \- Point \. Solidus \/ |
| 59 | % Colon \: Semicolon \; Less than \< |
| 60 | % Equals \= Greater than \> Question mark \? |
| 61 | % Commercial at \@ Left bracket \[ Backslash \\ |
| 62 | % Right bracket \] Circumflex \^ Underscore \_ |
| 63 | % Grave accent \` Left brace \{ Vertical bar \| |
| 64 | % Right brace \} Tilde \~} |
| 65 | % |
| 66 | % \changes{v1.0}{2019/07/14}{Initial version} |
| 67 | % |
| 68 | % \GetFileInfo{apuntsfme.sty} |
| 69 | % \GetFileInfo{apuntsfme.dtx} |
| 70 | % |
| 71 | % |
| 72 | % \title{The \textsf{ApuntsFME} package\thanks{This document |
| 73 | % corresponds to \textsf{apuntsfme}~\fileversion, |
| 74 | % dated~\filedate.}} |
| 75 | % \author{Ernesto Lanchares\\ \texttt{e.lancha98@gmail.com} \and Oscar Benedito \\ \texttt{oscar.benedito2@gmail.com}} |
| 76 | % |
| 77 | % \maketitle |
| 78 | % |
| 79 | % \begin{abstract} |
| 80 | % A package that aims to make taking notes in math class in \LaTeX\ easy. |
| 81 | % \end{abstract} |
| 82 | % |
| 83 | % TODO hacer la documentacion |
| 84 | % |
| 85 | % \StopEventually{} |
| 86 | % |
| 87 | % \section{Package implementation} |
| 88 | % \iffalse |
| 89 | %<*package> |
| 90 | % \fi |
| 91 | % \subsection{Includes} |
| 92 | % |
| 93 | % In the first place, we need to import some other packages (in fact, a lot of them). We |
| 94 | % considered that there's no need in reinventing the wheel so our work is based on this packages |
| 95 | % |
| 96 | % \begin{macrocode} |
| 97 | \RequirePackage[utf8]{inputenc} |
| 98 | \RequirePackage[T1]{fontenc} |
| 99 | \RequirePackage{hyperref} |
| 100 | \RequirePackage[shortlabels]{enumitem} |
| 101 | \RequirePackage{amsmath,amsthm,amssymb,graphicx,mathtools,tikz,makeidx} |
| 102 | \RequirePackage{cancel,pgf,pgfplots,mathrsfs,thmtools,tikz-cd,faktor} |
| 103 | \RequirePackage{physics} |
| 104 | |
| 105 | \usetikzlibrary{positioning,arrows, calc, babel} |
| 106 | \usetikzlibrary{external} |
| 107 | \tikzexternalize[prefix=figures/] |
| 108 | \pgfplotsset{compat=1.11} |
| 109 | % \end{macrocode} |
| 110 | % |
| 111 | % And some style definitions, just because we can. |
| 112 | % \begin{macrocode} |
| 113 | \let\emptyset\varnothing |
| 114 | \setcounter{secnumdepth}{4} |
| 115 | \def\mydate{\today} |
| 116 | \hypersetup{ |
| 117 | colorlinks, |
| 118 | linkcolor=blue |
| 119 | } |
| 120 | % \end{macrocode} |
| 121 | % |
| 122 | % Then we have lots of packages that we want to remove but have some documents that use them |
| 123 | % so we don't remove them because laziness. |
| 124 | % \begin{macrocode} |
| 125 | \RequirePackage{xfrac} % Fa els sfrac, per cert un a multi esta malamanet?? |
| 126 | \RequirePackage{siunitx} %Crec que cal canviar codi |
| 127 | \RequirePackage{centernot} % Aixo es exclusiu d'estructures per fer un \not concret als mid? |
| 128 | \RequirePackage{multicol} % Exclusiu dels formularis? |
| 129 | \RequirePackage{xcolor} % Aixo potser es d'un document concret |
| 130 | \RequirePackage{needspace} %No se si es gaire util, compila sense incloure'l |
| 131 | \RequirePackage{commath} % Aquest implement els \dif, cal canviar tot el codi per ferho amb physics |
| 132 | \RequirePackage{float} % No se que fa pero compila si el trec |
| 133 | \RequirePackage{dsfont} % No se que fa, compila si el trec |
| 134 | \RequirePackage{mdframed,cleveref,stackengine,stmaryrd,multirow} |
| 135 | % \end{macrocode} |
| 136 | % |
| 137 | % \subsection{Useful commands} |
| 138 | % In this section we provide some useful commands. |
| 139 | % |
| 140 | % We start with some commands that need to be removed but again, laziness |
| 141 | % \begin{macrocode} |
| 142 | %\newcommand{\ap}[1]{\ensuremath\overline{#1}} |
| 143 | %\newcommand{\Sup}[1]{\ensuremath\underset{#1}{\sup}} |
| 144 | %\newcommand{\Max}[1]{\ensuremath\underset{#1}{\max}} |
| 145 | %\newcommand{\Min}[1]{\ensuremath\underset{#1}{\min}} |
| 146 | %\newcommand{\scin}[1]{\ensuremath\SI{#1}{}} |
| 147 | \newcommand\comp[1]{\overline{#1}} % Treure? #SouUnsVagos |
| 148 | \newcommand\inv[1]{#1^{-1}} % Habra que sacarlo de algun documento? |
| 149 | \newcommand{\ita}[1]{\textit{#1}} % Habra que sacarlo de algun documento? |
| 150 | \newmdenv[leftline=false,topline=false]{topright} |
| 151 | % \end{macrocode} |
| 152 | % |
| 153 | % Now we can proceed into the part that we are proud of. First some commands |
| 154 | % \begin{macrocode} |
| 155 | %\newcommand\mapsfrom{\mathrel{\reflectbox{\ensuremath{\mapsto}}}} %Already defined? |
| 156 | \newcommand*{\bimplies}{\boxed{\implies}} |
| 157 | \newcommand*{\bimpliedby}{\boxed{\impliedby}} |
| 158 | % \end{macrocode} |
| 159 | % |
| 160 | % \subsubsection{Mathbb commands} |
| 161 | % Again, with some parts that needs removing/refactoring |
| 162 | % \begin{macrocode} |
| 163 | \newcommand{\n}{\mathbb{N}} |
| 164 | \newcommand{\z}{\mathbb{Z}} |
| 165 | \newcommand{\q}{\mathbb{Q}} |
| 166 | \newcommand{\cx}{\mathbb{C}} |
| 167 | \renewcommand{\real}{\mathbb{R}} |
| 168 | \newcommand{\E}{\mathbb{E}} |
| 169 | \newcommand{\F}{\mathbb{F}} |
| 170 | \newcommand{\A}{\mathbb{A}} |
| 171 | \newcommand{\bb}[1]{\mathbb{#1}} |
| 172 | \newcommand{\Po}{\mathbb{P}} |
| 173 | \newcommand{\esp}{\mathbb{E}} |
| 174 | \DeclareMathOperator{\cov}{\mathbb{C}ov} % TODO esto que? |
| 175 | \let\var\relax |
| 176 | \DeclareMathOperator{\var}{\mathbb{V}ar} % TODO esto que? |
| 177 | % \end{macrocode} |
| 178 | % |
| 179 | % \subsubsection{Mathcal commands} |
| 180 | % |
| 181 | % \begin{macrocode} |
| 182 | \newcommand{\R}{\mathcal{R}} |
| 183 | \newcommand{\Pa}{\mathcal{P}} |
| 184 | \newcommand{\Es}{\mathcal{E}} |
| 185 | \newcommand{\V}{\mathcal{V}} |
| 186 | \newcommand{\T}{\mathcal{T}} |
| 187 | \newcommand{\B}{\mathcal{B}} |
| 188 | \let\O\relax |
| 189 | \newcommand{\O}{\mathcal{O}} |
| 190 | \newcommand{\Sim}{\mathcal{S}} |
| 191 | \newcommand{\Asim}{\mathcal{A}} % TODO aquest i el dabaix son el mateix |
| 192 | \newcommand{\Asuc}{\mathcal{A}} % Conjunt de successos |
| 193 | \newcommand{\matspace}{\mathcal{M}} %Espai de matrius |
| 194 | % \end{macrocode} |
| 195 | % |
| 196 | % \subsubsection{Mathscr and others} |
| 197 | % \begin{macrocode} |
| 198 | \newcommand{\C}{\mathscr{C}} |
| 199 | \let\k\relax |
| 200 | \newcommand{\k}{\Bbbk} |
| 201 | % \end{macrocode} |
| 202 | % |
| 203 | % \subsubsection{Math utilities} |
| 204 | % \begin{macrocode} |
| 205 | \newcommand{\trir}{\triangleright} |
| 206 | \newcommand{\tril}{\triangleleft} |
| 207 | \newcommand{\limvar}[2]{\lim\limits_{#1 \rightarrow #2}} % Para escribir limites más rapido |
| 208 | \newcommand{\notimplies}{\mathrel{{\ooalign{\hidewidth$\not\phantom{=}$% |
| 209 | \hidewidth\cr$\implies$}}}} |
| 210 | \newcommand{\defeq}{\stackrel{\text{\tiny def}}{=}} % Símbol 'definit com' |
| 211 | \def\upint{\mathchoice% |
| 212 | {\mkern13mu\overline{\vphantom{\intop}\mkern7mu}\mkern-20mu}% |
| 213 | {\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}% |
| 214 | {\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}% |
| 215 | {\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}% |
| 216 | \int} |
| 217 | \def\lowint{\mkern3mu\underline{\vphantom{\intop}\mkern7mu}\mkern-10mu\int} |
| 218 | % \end{macrocode} |
| 219 | % |
| 220 | % \subsubsection{Left-right thing} |
| 221 | % For good practice this ones should be removed but hey using an IDE with macro insertion |
| 222 | % is aparently very difficult... |
| 223 | % \begin{macrocode} |
| 224 | \newcommand\setb[1]{\left\{#1\right\}} % Deberia irse? |
| 225 | \newcommand{\vbrack}[1]{\langle #1\rangle} |
| 226 | \newcommand{\spr}[1]{\langle #1 \rangle} % TODO aquest i lanterior son el mateix |
| 227 | \newcommand{\lp}{\left(} |
| 228 | \newcommand{\rp}{\right)} |
| 229 | \newcommand{\lc}{\left\{} |
| 230 | \newcommand{\rc}{\right\}} |
| 231 | \newcommand{\lb}{\left[} |
| 232 | \newcommand{\rb}{\right]} |
| 233 | % \end{macrocode} |
| 234 | % |
| 235 | % \subsubsection{Math operators} |
| 236 | % \begin{macrocode} |
| 237 | \DeclareMathOperator{\Ec}{Ec} |
| 238 | \DeclareMathOperator{\Ep}{Ep} |
| 239 | \DeclareMathOperator{\orden}{o} |
| 240 | \DeclareMathOperator{\ord}{ord} |
| 241 | \DeclareMathOperator{\card}{card} |
| 242 | \DeclareMathOperator{\mcm}{mcm} |
| 243 | \DeclareMathOperator{\mcd}{mcd} |
| 244 | \DeclareMathOperator{\Em}{Em} |
| 245 | \DeclareMathOperator*{\argmax}{arg\,max} |
| 246 | \DeclareMathOperator*{\argmin}{arg\,min} |
| 247 | \DeclareMathOperator{\fr}{Fr} |
| 248 | \DeclareMathOperator{\Id}{Id} |
| 249 | \DeclareMathOperator{\ext}{Ext} |
| 250 | \DeclareMathOperator{\inte}{Int} |
| 251 | \DeclareMathOperator{\rie}{Rie} |
| 252 | \DeclareMathOperator{\rg}{rg} |
| 253 | \DeclareMathOperator{\gr}{gr} |
| 254 | \DeclareMathOperator{\nuc}{Nuc} |
| 255 | \DeclareMathOperator{\car}{car} |
| 256 | \DeclareMathOperator{\im}{Im} |
| 257 | %\DeclareMathOperator{\tr}{tr} % Already in physics |
| 258 | \DeclareMathOperator{\vol}{vol} |
| 259 | %\DeclareMathOperator{\grad}{grad} % Already in physics |
| 260 | \DeclareMathOperator{\rot}{rot} |
| 261 | \DeclareMathOperator{\diver}{div} |
| 262 | \DeclareMathOperator{\sinc}{sinc} |
| 263 | \DeclareMathOperator{\graf}{graf} |
| 264 | \DeclareMathOperator{\tq}{\;t.q.\;} |
| 265 | \DeclareMathOperator{\disc}{disc} |
| 266 | \DeclareMathOperator{\fl}{fl} % Representación en coma flotante |
| 267 | \DeclareMathOperator{\sgn}{sgn} % Función signo (sgn) de una permutación |
| 268 | \DeclareMathOperator{\diag}{diag} % Notación corta para matriz diagonal: diag(d_1,...,d_n) |
| 269 | \DeclareMathOperator{\vspan}{span} |
| 270 | % \end{macrocode} |
| 271 | % |
| 272 | % \subsubsection{Index} |
| 273 | % \begin{macrocode} |
| 274 | \newcounter{apuntsfme@index} |
| 275 | \setcounter{apuntsfme@index}{1} |
| 276 | \def\consume#1{}% |
| 277 | \def\printcmd{\expandafter\consume\string} |
| 278 | \def\idx#1{% |
| 279 | \label{apuntsfme@index:#1}% |
| 280 | \expandafter\gdef\csname indice\Roman{apuntsfme@index}\endcsname% |
| 281 | ##1{\hyperref[apuntsfme@index:#1]{##1}}% |
| 282 | \index{#1|\expandafter\printcmd\csname indice\Roman{apuntsfme@index}\endcsname}% |
| 283 | \stepcounter{apuntsfme@index} |
| 284 | } |
| 285 | |
| 286 | \makeindex |
| 287 | \RequirePackage[totoc]{idxlayout} % Glossari a l'índex |
| 288 | % \end{macrocode} |
| 289 | % |
| 290 | % \subsection{Environments} |
| 291 | % Here we define the environments in which the notes we take are based on. |
| 292 | % |
| 293 | % TODO add an option to the package to select the position of the number (before/after) |
| 294 | % \begin{macrocode} |
| 295 | \newtheoremstyle{break}% name |
| 296 | {}% Space above, empty = `usual value' |
| 297 | {}% Space below |
| 298 | {}% Body font |
| 299 | {}% Indent amount (empty = no indent, \parindent = para indent) |
| 300 | {\bfseries}% Thm head font |
| 301 | {}% Punctuation after thm head |
| 302 | {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak |
| 303 | {\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}\newline}}% Thm head spec |
| 304 | |
| 305 | \newtheoremstyle{demo}% name |
| 306 | {}% Space above, empty = `usual value' |
| 307 | {}% Space below |
| 308 | {}% Body font |
| 309 | {}% Indent amount (empty = no indent, \parindent = para indent) |
| 310 | {\it}% Thm head font |
| 311 | {}% Punctuation after thm head |
| 312 | {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak |
| 313 | {#1\thmnote{ #3}.}% Thm head spec |
| 314 | |
| 315 | \newtheoremstyle{breakthm}% name |
| 316 | {}% Space above, empty = `usual value' |
| 317 | {}% Space below |
| 318 | {}% Body font |
| 319 | {}% Indent amount (empty = no indent, \parindent = para indent) |
| 320 | {\bfseries}% Thm head font |
| 321 | {}% Punctuation after thm head |
| 322 | {\newline}% Space after thm head: \newline = linebreak |
| 323 | {\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}}\addcontentsline{toc}{subsection}{#3}}% Thm head spec |
| 324 | |
| 325 | \newtheoremstyle{normal}% name |
| 326 | {}% Space above, empty = `usual value' |
| 327 | {}% Space below |
| 328 | {}% Body font |
| 329 | {}% Indent amount (empty = no indent, \parindent = para indent) |
| 330 | {\bfseries}% Thm head font |
| 331 | {}% Punctuation after thm head |
| 332 | {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak |
| 333 | {\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}}}% Thm head spec |
| 334 | |
| 335 | \newtheoremstyle{autodefi}% name |
| 336 | {}% Space above, empty = `usual value' |
| 337 | {}% Space below |
| 338 | {}% Body font |
| 339 | {}% Indent amount (empty = no indent, \parindent = para indent) |
| 340 | {\bfseries}% Thm head font |
| 341 | {}% Punctuation after thm head |
| 342 | {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak |
| 343 | {\index{#3((defi:#2))}\label{defi:#2}\thmname{#1}\thmnumber{ #2}.}% Thm head specko |
| 344 | % \end{macrocode} |
| 345 | % |
| 346 | % \subsection{Options} |
| 347 | % Here we have some options for the package |
| 348 | % |
| 349 | % \subsubsection{Babel} |
| 350 | % TODO add english support and make it the default |
| 351 | % \begin{macrocode} |
| 352 | \newif\if@babel\@babeltrue |
| 353 | \def\@babellang{english} |
| 354 | \DeclareOption{nobabel}{ |
| 355 | \@babelfalse |
| 356 | } |
| 357 | |
| 358 | \DeclareOption{spanish}{ |
| 359 | \gdef\@babellang{spanish,es-lcroman} |
| 360 | % Normal |
| 361 | \declaretheorem[style=normal,name=Lema,numberwithin=section]{lema} |
| 362 | \declaretheorem[style=normal,name=Lema,numbered=no]{lema*} |
| 363 | \declaretheorem[style=normal,name=Observación,sibling=lema]{obs} |
| 364 | \declaretheorem[style=normal,name=Observación,numbered=no]{obs*} |
| 365 | \declaretheorem[style=normal,name=Proposición,sibling=lema]{prop} |
| 366 | \declaretheorem[style=normal,name=Proposición,numbered=no]{prop*} |
| 367 | \declaretheorem[style=normal,name=Definición,sibling=lema]{defi*} |
| 368 | \declaretheorem[style=normal,name=Corolario,sibling=lema]{col} |
| 369 | \declaretheorem[style=normal,name=Corolario,numbered=no]{col*} |
| 370 | \declaretheorem[style=normal,name=Ejercicio,sibling=lema]{ej} |
| 371 | \declaretheorem[style=normal,name=Ejercicio,numbered=no]{ej*} |
| 372 | \declaretheorem[style=normal,name=Ejemplo,sibling=lema]{example} |
| 373 | \declaretheorem[style=normal,name=Ejemplo,numbered=no]{example*} |
| 374 | \declaretheorem[style=normal,name=Problema,sibling=lema]{problema} |
| 375 | \declaretheorem[style=normal,name=Problema,numbered=no]{problema*} |
| 376 | |
| 377 | % Autodefi |
| 378 | \declaretheorem[style=autodefi,name=Definición,sibling=lema]{defi} |
| 379 | |
| 380 | % Demo |
| 381 | \let\proof\relax |
| 382 | \declaretheorem[style=demo,name=Demostración,qed=$\square$,numbered=no]{proof} |
| 383 | \declaretheorem[style=demo,name=Solución,numbered=no]{sol} |
| 384 | |
| 385 | % Break |
| 386 | \declaretheorem[style=break,name=Teorema,sibling=lema]{teo*} |
| 387 | |
| 388 | % Breakthm |
| 389 | \declaretheorem[style=breakthm,name=Teorema,sibling=lema]{teo} |
| 390 | |
| 391 | |
| 392 | |
| 393 | \@ifclassloaded{book}{% |
| 394 | \AtBeginDocument{\renewcommand{\contentsname}{Contenidos}} |
| 395 | \AtBeginDocument{\renewcommand{\chaptername}{Tema}} |
| 396 | }{} |
| 397 | } |
| 398 | |
| 399 | \DeclareOption{catalan}{ |
| 400 | \gdef\@babellang{catalan} |
| 401 | |
| 402 | % Normal |
| 403 | \declaretheorem[style=normal,name=Lema,numberwithin=section]{lema} |
| 404 | \declaretheorem[style=normal,name=Lema,numbered=no]{lema*} |
| 405 | \declaretheorem[style=normal,name=Observació,sibling=lema]{obs} |
| 406 | \declaretheorem[style=normal,name=Observació,numbered=no]{obs*} |
| 407 | \declaretheorem[style=normal,name=Proposició,sibling=lema]{prop} |
| 408 | \declaretheorem[style=normal,name=Proposició,numbered=no]{prop*} |
| 409 | \declaretheorem[style=normal,name=Definició,sibling=lema]{defi*} |
| 410 | \declaretheorem[style=normal,name=Corol·lari,sibling=lema]{col} |
| 411 | \declaretheorem[style=normal,name=Corol·lari,numbered=no]{col*} |
| 412 | \declaretheorem[style=normal,name=Exercici,sibling=lema]{ej} |
| 413 | \declaretheorem[style=normal,name=Exercici,numbered=no]{ej*} |
| 414 | \declaretheorem[style=normal,name=Exemple,sibling=lema]{example} |
| 415 | \declaretheorem[style=normal,name=Exemple,numbered=no]{example*} |
| 416 | \declaretheorem[style=normal,name=Problema,sibling=lema]{problema} |
| 417 | \declaretheorem[style=normal,name=Problema,numbered=no]{problema*} |
| 418 | |
| 419 | % Autodefi |
| 420 | \declaretheorem[style=autodefi,name=Definició,sibling=lema]{defi} |
| 421 | |
| 422 | % Demo |
| 423 | \let\proof\relax |
| 424 | \declaretheorem[style=demo,name=Demostració,qed=$\square$,numbered=no]{proof} |
| 425 | \declaretheorem[style=demo,name=Solució,numbered=no]{sol} |
| 426 | |
| 427 | % Break |
| 428 | \declaretheorem[style=break,name=Teorema,sibling=lema]{teo*} |
| 429 | |
| 430 | % Breakthm |
| 431 | \declaretheorem[style=breakthm,name=Teorema,sibling=lema]{teo} |
| 432 | } |
| 433 | |
| 434 | |
| 435 | \ProcessOptions\relax |
| 436 | \if@babel |
| 437 | \PassOptionsToPackage{\@babellang}{babel} |
| 438 | \RequirePackage{babel} |
| 439 | \fi |
| 440 | % \end{macrocode} |
| 441 | % |
| 442 | % \iffalse |
| 443 | %</package> |
| 444 | % \fi |
| 445 | % \section{Class implementation} |
| 446 | % \iffalse |
| 447 | %<*class> |
| 448 | % \fi |
| 449 | % \subsection{Imports} |
| 450 | % \begin{macrocode} |
| 451 | \RequirePackage[utf8]{inputenc} |
| 452 | \RequirePackage[T1]{fontenc} |
| 453 | \RequirePackage{graphicx} |
| 454 | % \end{macrocode} |
| 455 | % |
| 456 | % \subsection{Language} |
| 457 | % The default language is english |
| 458 | % \begin{macrocode} |
| 459 | \newcommand*{\@authortext}{Author} |
| 460 | \newcommand*{\@authorstext}{Authors} |
| 461 | \newcommand*{\@otherauthortext}{Other authors} |
| 462 | \newcommand*{\@reviewertext}{Reviewer} |
| 463 | \newcommand*{\@reviewerstext}{Reviewers} |
| 464 | \newcommand*{\@lastupdatetext}{Last update} |
| 465 | \newcommand*{\@titlemonth}{\ifcase \the\month \or January\or February\or March\or April\or May \or June\or July\or August\or September\or October\or November\or December\fi \: \number \year} |
| 466 | \newcommand*{\titlemonth}[1]{\gdef\@titlemonth{#1}} |
| 467 | |
| 468 | \DeclareOption{spanish}{ |
| 469 | \renewcommand*{\languagename}{spanish} |
| 470 | \renewcommand*{\@authortext}{Autor principal} |
| 471 | \renewcommand*{\@authorstext}{Autores principales} |
| 472 | \renewcommand*{\@otherauthortext}{Otros autores} |
| 473 | \renewcommand*{\@reviewertext}{Revisor} |
| 474 | \renewcommand*{\@reviewerstext}{Revisores} |
| 475 | \renewcommand*{\@lastupdatetext}{\'Ultima modificaci\'on} |
| 476 | \renewcommand*{\@titlemonth}{\ifcase \the\month \or Enero\or Febrero\or Marzo\or Abril\or Mayo \or Junio\or Julio\or Agosto\or Septiembre\or Octubre\or Noviembre\or Diciembre\fi \: \number \year} |
| 477 | |
| 478 | \AtBeginDocument{\renewcommand{\contentsname}{Contenidos}} |
| 479 | \AtBeginDocument{\renewcommand{\chaptername}{Tema}} |
| 480 | } |
| 481 | |
| 482 | \DeclareOption{catalan}{ |
| 483 | \renewcommand*{\languagename}{catalan} |
| 484 | \renewcommand*{\@authortext}{Autor principal} |
| 485 | \renewcommand*{\@authorstext}{Autors principals} |
| 486 | \renewcommand*{\@otherauthortext}{Altres autors} |
| 487 | \renewcommand*{\@reviewertext}{Revisor} |
| 488 | \renewcommand*{\@reviewerstext}{Revisors} |
| 489 | \renewcommand*{\@lastupdatetext}{\'Ultima modificaci\'o} |
| 490 | \renewcommand*{\@titlemonth}{\ifcase \the\month \or Gener\or Febrer\or Mar\c{c}\or Abril\or Maig \or Juny\or Juliol\or Agost\or Setembre\or Octubre\or Novembre\or Desembre\fi \: \number \year} |
| 491 | |
| 492 | \AtBeginDocument{\renewcommand{\contentsname}{Continguts}} |
| 493 | \ AtBeginDocument{\renewcommand{\chaptername}{Tema}} |
| 494 | } |
| 495 | % \end{macrocode} |
| 496 | % |
| 497 | % \subsection{Metatadata} |
| 498 | % TODO creo que no funciona o algo así... |
| 499 | % \begin{macrocode} |
| 500 | \newcommand*{\generatemetadata}{% |
| 501 | \renewcommand*{\and}{ and } |
| 502 | \hypersetup{ |
| 503 | pdfauthor={\@author} |
| 504 | } |
| 505 | \renewcommand*{\and}{ } |
| 506 | \hypersetup{ |
| 507 | pdftitle={{\@title} -- ApuntsFME}, |
| 508 | pdfsubject={\@title}, |
| 509 | pdfkeywords={ApuntsFME}, |
| 510 | } |
| 511 | } |
| 512 | % \end{macrocode} |
| 513 | % |
| 514 | % \subsection{Process options} |
| 515 | % \begin{macrocode} |
| 516 | \ProcessOptions\relax |
| 517 | % \end{macrocode} |
| 518 | % |
| 519 | % \subsection{Import class} |
| 520 | % Again we don't think making the whole thing from scratch was viable. |
| 521 | % \begin{macrocode} |
| 522 | \LoadClass[12pt]{book} |
| 523 | % \end{macrocode} |
| 524 | % |
| 525 | % \subsection{Title page} |
| 526 | % Here we create the title page, one of the strengths of this class |
| 527 | % |
| 528 | % \subsubsection{Last update} |
| 529 | % \begin{macrocode} |
| 530 | \newif\if@lastupdate\@lastupdatetrue |
| 531 | \newcommand*{\nolastupdate}{\@lastupdatefalse} |
| 532 | % \end{macrocode} |
| 533 | % |
| 534 | % \subsubsection{Authors} |
| 535 | % \begin{macrocode} |
| 536 | \newcommand*{\@metaauthor}{} |
| 537 | |
| 538 | \long\def\countingloop#1 in #2:#3#4{% |
| 539 | #1=#2% |
| 540 | \loopcounter{#1}{#3}{#4}% |
| 541 | } |
| 542 | \long\def\loopcounter#1#2#3{% |
| 543 | #3% |
| 544 | \ifnum#1=#2 % |
| 545 | \let\next\relax% |
| 546 | \else% |
| 547 | \advance#1 by1 % |
| 548 | \def\next{\loopcounter{#1}{#2}{#3}}% |
| 549 | \fi |
| 550 | \next |
| 551 | } |
| 552 | |
| 553 | \newcount\apuntsfme@numberauthor |
| 554 | \apuntsfme@numberauthor=0 |
| 555 | |
| 556 | \def\@author{} |
| 557 | \renewcommand*{\author}[1]{% |
| 558 | \expandafter\gdef\csname apuntsfme@author\the\apuntsfme@numberauthor\endcsname{#1}% |
| 559 | \advance\apuntsfme@numberauthor by1 % |
| 560 | } |
| 561 | % \end{macrocode} |
| 562 | % |
| 563 | % \subsubsection{Other Authors} |
| 564 | % \begin{macrocode} |
| 565 | \newcommand*{\@otherauthor}{} |
| 566 | \newcommand{\otherauthor}[1]{\gdef\@otherauthor{#1}} |
| 567 | % \end{macrocode} |
| 568 | % |
| 569 | % \subsubsection{Reviewers} |
| 570 | % \begin{macrocode} |
| 571 | \newcommand*{\@reviewer}{} |
| 572 | \newcommand*{\reviewer}[1]{\gdef\@reviewer{#1}} |
| 573 | % \end{macrocode} |
| 574 | % |
| 575 | % \subsubsection{Subtitle} |
| 576 | % \begin{macrocode} |
| 577 | \newcommand*{\subtitle}[1]{\gdef\@subtitle{#1}} |
| 578 | \newcommand*{\@subtitle}{} |
| 579 | % \end{macrocode} |
| 580 | % |
| 581 | % \subsubsection{Thanks comment} |
| 582 | % \begin{macrocode} |
| 583 | \newcommand*{\thankscomment}[1]{\gdef\@thankscomment{#1}} |
| 584 | \newcommand*{\@thankscomment}{} |
| 585 | % \end{macrocode} |
| 586 | % |
| 587 | % \subsubsection{Title page} |
| 588 | % All of the previous sections are combined here were we actually make the title page. |
| 589 | % TODO remove doclicense |
| 590 | % \begin{macrocode} |
| 591 | \renewcommand*{\maketitle}{% |
| 592 | \generatemetadata |
| 593 | \begin{titlepage} |
| 594 | \centering\scshape |
| 595 | \vspace*{\fill} |
| 596 | \rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt} |
| 597 | \rule{\textwidth}{0.4pt} |
| 598 | \vspace{0.75\baselineskip} |
| 599 | \renewcommand*{\and}{\unskip\protect\\} % TODO aqui malament |
| 600 | {\LARGE \expandafter\MakeUppercase\expandafter{\@title}\\} |
| 601 | |
| 602 | \vspace{0.75\baselineskip} |
| 603 | |
| 604 | \rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} |
| 605 | \rule{\textwidth}{1.6pt} |
| 606 | |
| 607 | \vspace{1.5\baselineskip} |
| 608 | |
| 609 | \@subtitle |
| 610 | |
| 611 | \vspace*{\fill} |
| 612 | \vspace*{\fill} |
| 613 | \vspace*{\fill} |
| 614 | \vspace*{\fill} |
| 615 | \vspace*{\fill} |
| 616 | \vspace*{\fill} |
| 617 | |
| 618 | \includegraphics[width=5cm]{../logo.pdf} |
| 619 | |
| 620 | \vspace{0.3\baselineskip} |
| 621 | |
| 622 | Barcelona, \@titlemonth |
| 623 | \end{titlepage} |
| 624 | |
| 625 | \vspace*{\fill} |
| 626 | |
| 627 | \ifnum\apuntsfme@numberauthor=0 |
| 628 | \else |
| 629 | \newcount\apuntsfme@tempauthor |
| 630 | \countingloop{\apuntsfme@tempauthor} in 0:\apuntsfme@numberauthor{% |
| 631 | Hola \csname apuntsfme@author\the\apuntsfme@tempauthor\endcsname |
| 632 | } |
| 633 | \fi |
| 634 | \ifx\@otherauthor\empty |
| 635 | \else |
| 636 | |
| 637 | \quad |
| 638 | |
| 639 | \noindent \@otherauthortext: \@otherauthor. |
| 640 | \fi |
| 641 | \ifx\@reviewer\empty |
| 642 | \else |
| 643 | |
| 644 | \quad |
| 645 | |
| 646 | \renewcommand{\and}{\renewcommand*{\@reviewertext}{\@reviewerstext}}% |
| 647 | \nullfont\noindent\@reviewer\normalfont% |
| 648 | \renewcommand{\and}{\unskip, }% |
| 649 | \noindent \@reviewertext: \@reviewer. |
| 650 | \fi |
| 651 | \ifx\@thankscomment\empty |
| 652 | \else |
| 653 | |
| 654 | \quad |
| 655 | |
| 656 | \noindent \@thankscomment |
| 657 | \fi |
| 658 | \if@lastupdate |
| 659 | |
| 660 | \quad |
| 661 | |
| 662 | \noindent \@lastupdatetext: \@date. |
| 663 | \fi |
| 664 | |
| 665 | \doclicenseThis |
| 666 | } |
| 667 | % \end{macrocode} |
| 668 | % |
| 669 | % \subsection{Other commands} |
| 670 | % |
| 671 | % \begin{macro}{\makecover} |
| 672 | % \begin{macrocode} |
| 673 | \newcommand*{\makecover}{ |
| 674 | \frontmatter |
| 675 | \maketitle |
| 676 | \tableofcontents |
| 677 | \mainmatter |
| 678 | } |
| 679 | % \end{macrocode} |
| 680 | % \end{macro} |
| 681 | % |
| 682 | % \subsection{Other includes} |
| 683 | % These packages need to be included last, so we place them here. TODO remove doclicense |
| 684 | % \begin{macrocode} |
| 685 | \RequirePackage[a4paper,margin=1in]{geometry} |
| 686 | \RequirePackage{hyperref} |
| 687 | \RequirePackage[ |
| 688 | type={CC}, |
| 689 | modifier={by-nc-sa}, |
| 690 | version={4.0}, |
| 691 | ]{doclicense} |
| 692 | % \end{macrocode} |
| 693 | % |
| 694 | % \iffalse |
| 695 | %</class> |
| 696 | % \fi |