blob: 5201352919160ad886cc22dcfb12a4c4303b6040 [file] [log] [blame]
oscarbenedito6bc418b2019-09-20 13:28:57 +02001% \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.}}
oscarbeneditoef77d902019-09-30 19:44:52 +020075% \author{Ernesto Lanchares\\ \href{mailto:e.lancha98@gmail.com}{e.lancha98@gmail.com} \and Oscar Benedito \\ \href{mailto:oscar@obenedito.org}{oscar@obenedito.org}}
oscarbenedito6bc418b2019-09-20 13:28:57 +020076%
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}
oscarbeneditoef77d902019-09-30 19:44:52 +020099\RequirePackage{lmodern}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200100\RequirePackage{hyperref}
101\RequirePackage[shortlabels]{enumitem}
102\RequirePackage{amsmath,amsthm,amssymb,graphicx,mathtools,tikz,makeidx}
103\RequirePackage{cancel,pgf,pgfplots,mathrsfs,thmtools,tikz-cd,faktor}
104\RequirePackage{physics}
105
106\usetikzlibrary{positioning,arrows, calc, babel}
107\usetikzlibrary{external}
108\tikzexternalize[prefix=figures/]
109\pgfplotsset{compat=1.11}
110% \end{macrocode}
111%
112% And some style definitions, just because we can.
113% \begin{macrocode}
114\let\emptyset\varnothing
115\setcounter{secnumdepth}{4}
116\def\mydate{\today}
117\hypersetup{
118 colorlinks,
119 linkcolor=blue
120}
121% \end{macrocode}
122%
123% Then we have lots of packages that we want to remove but have some documents that use them
124% so we don't remove them because laziness.
125% \begin{macrocode}
126\RequirePackage{xfrac} % Fa els sfrac, per cert un a multi esta malamanet??
127\RequirePackage{siunitx} %Crec que cal canviar codi
128\RequirePackage{centernot} % Aixo es exclusiu d'estructures per fer un \not concret als mid?
129\RequirePackage{multicol} % Exclusiu dels formularis?
130\RequirePackage{xcolor} % Aixo potser es d'un document concret
131\RequirePackage{needspace} %No se si es gaire util, compila sense incloure'l
132\RequirePackage{commath} % Aquest implement els \dif, cal canviar tot el codi per ferho amb physics
133\RequirePackage{float} % No se que fa pero compila si el trec
134\RequirePackage{dsfont} % No se que fa, compila si el trec
135\RequirePackage{mdframed,cleveref,stackengine,stmaryrd,multirow}
136% \end{macrocode}
137%
138% \subsection{Useful commands}
139% In this section we provide some useful commands.
140%
141% We start with some commands that need to be removed but again, laziness
142% \begin{macrocode}
143%\newcommand{\ap}[1]{\ensuremath\overline{#1}}
144%\newcommand{\Sup}[1]{\ensuremath\underset{#1}{\sup}}
145%\newcommand{\Max}[1]{\ensuremath\underset{#1}{\max}}
146%\newcommand{\Min}[1]{\ensuremath\underset{#1}{\min}}
147%\newcommand{\scin}[1]{\ensuremath\SI{#1}{}}
148\newcommand\comp[1]{\overline{#1}} % Treure? #SouUnsVagos
149\newcommand\inv[1]{#1^{-1}} % Habra que sacarlo de algun documento?
150\newcommand{\ita}[1]{\textit{#1}} % Habra que sacarlo de algun documento?
151\newmdenv[leftline=false,topline=false]{topright}
152% \end{macrocode}
153%
154% Now we can proceed into the part that we are proud of. First some commands
155% \begin{macrocode}
156%\newcommand\mapsfrom{\mathrel{\reflectbox{\ensuremath{\mapsto}}}} %Already defined?
157\newcommand*{\bimplies}{\boxed{\implies}}
158\newcommand*{\bimpliedby}{\boxed{\impliedby}}
159% \end{macrocode}
160%
161% \subsubsection{Mathbb commands}
162% Again, with some parts that needs removing/refactoring
163% \begin{macrocode}
164\newcommand{\n}{\mathbb{N}}
165\newcommand{\z}{\mathbb{Z}}
166\newcommand{\q}{\mathbb{Q}}
167\newcommand{\cx}{\mathbb{C}}
168\renewcommand{\real}{\mathbb{R}}
169\newcommand{\E}{\mathbb{E}}
170\newcommand{\F}{\mathbb{F}}
171\newcommand{\A}{\mathbb{A}}
172\newcommand{\bb}[1]{\mathbb{#1}}
173\newcommand{\Po}{\mathbb{P}}
174\newcommand{\esp}{\mathbb{E}}
175\DeclareMathOperator{\cov}{\mathbb{C}ov} % TODO esto que?
176\let\var\relax
177\DeclareMathOperator{\var}{\mathbb{V}ar} % TODO esto que?
178% \end{macrocode}
179%
180% \subsubsection{Mathcal commands}
181%
182% \begin{macrocode}
183\newcommand{\R}{\mathcal{R}}
184\newcommand{\Pa}{\mathcal{P}}
185\newcommand{\Es}{\mathcal{E}}
186\newcommand{\V}{\mathcal{V}}
187\newcommand{\T}{\mathcal{T}}
188\newcommand{\B}{\mathcal{B}}
189\let\O\relax
190\newcommand{\O}{\mathcal{O}}
191\newcommand{\Sim}{\mathcal{S}}
192\newcommand{\Asim}{\mathcal{A}} % TODO aquest i el dabaix son el mateix
193\newcommand{\Asuc}{\mathcal{A}} % Conjunt de successos
194\newcommand{\matspace}{\mathcal{M}} %Espai de matrius
195% \end{macrocode}
196%
197% \subsubsection{Mathscr and others}
198% \begin{macrocode}
199\newcommand{\C}{\mathscr{C}}
200\let\k\relax
201\newcommand{\k}{\Bbbk}
202% \end{macrocode}
203%
204% \subsubsection{Math utilities}
205% \begin{macrocode}
206\newcommand{\trir}{\triangleright}
207\newcommand{\tril}{\triangleleft}
208\newcommand{\limvar}[2]{\lim\limits_{#1 \rightarrow #2}} % Para escribir limites más rapido
209\newcommand{\notimplies}{\mathrel{{\ooalign{\hidewidth$\not\phantom{=}$%
210 \hidewidth\cr$\implies$}}}}
211\newcommand{\defeq}{\stackrel{\text{\tiny def}}{=}} % Símbol 'definit com'
212\def\upint{\mathchoice%
213 {\mkern13mu\overline{\vphantom{\intop}\mkern7mu}\mkern-20mu}%
214 {\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
215 {\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
216 {\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
217 \int}
218\def\lowint{\mkern3mu\underline{\vphantom{\intop}\mkern7mu}\mkern-10mu\int}
219% \end{macrocode}
220%
221% \subsubsection{Left-right thing}
222% For good practice this ones should be removed but hey using an IDE with macro insertion
223% is aparently very difficult...
224% \begin{macrocode}
225\newcommand\setb[1]{\left\{#1\right\}} % Deberia irse?
226\newcommand{\vbrack}[1]{\langle #1\rangle}
227\newcommand{\spr}[1]{\langle #1 \rangle} % TODO aquest i lanterior son el mateix
228\newcommand{\lp}{\left(}
229\newcommand{\rp}{\right)}
230\newcommand{\lc}{\left\{}
231\newcommand{\rc}{\right\}}
232\newcommand{\lb}{\left[}
233\newcommand{\rb}{\right]}
234% \end{macrocode}
235%
236% \subsubsection{Math operators}
237% \begin{macrocode}
238\DeclareMathOperator{\Ec}{Ec}
239\DeclareMathOperator{\Ep}{Ep}
240\DeclareMathOperator{\orden}{o}
241\DeclareMathOperator{\ord}{ord}
242\DeclareMathOperator{\card}{card}
243\DeclareMathOperator{\mcm}{mcm}
244\DeclareMathOperator{\mcd}{mcd}
oscarbeneditoef77d902019-09-30 19:44:52 +0200245\DeclareMathOperator{\lcm}{lcm}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200246\DeclareMathOperator{\Em}{Em}
247\DeclareMathOperator*{\argmax}{arg\,max}
248\DeclareMathOperator*{\argmin}{arg\,min}
249\DeclareMathOperator{\fr}{Fr}
250\DeclareMathOperator{\Id}{Id}
251\DeclareMathOperator{\ext}{Ext}
252\DeclareMathOperator{\inte}{Int}
253\DeclareMathOperator{\rie}{Rie}
254\DeclareMathOperator{\rg}{rg}
255\DeclareMathOperator{\gr}{gr}
256\DeclareMathOperator{\nuc}{Nuc}
257\DeclareMathOperator{\car}{car}
258\DeclareMathOperator{\im}{Im}
oscarbeneditoaa0fe752019-10-01 13:13:01 +0200259\DeclareMathOperator{\re}{Re}
oscarbeneditoef77d902019-09-30 19:44:52 +0200260\DeclareMathOperator{\spec}{Spec}
261\DeclareMathOperator{\Log}{Log}
oscarbeneditoaa0fe752019-10-01 13:13:01 +0200262\DeclareMathOperator{\Arg}{Arg}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200263%\DeclareMathOperator{\tr}{tr} % Already in physics
264\DeclareMathOperator{\vol}{vol}
265%\DeclareMathOperator{\grad}{grad} % Already in physics
266\DeclareMathOperator{\rot}{rot}
267\DeclareMathOperator{\diver}{div}
268\DeclareMathOperator{\sinc}{sinc}
269\DeclareMathOperator{\graf}{graf}
oscarbeneditoef77d902019-09-30 19:44:52 +0200270\DeclareMathOperator{\TQ}{\text{ tal que }}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200271\DeclareMathOperator{\tq}{\;t.q.\;}
272\DeclareMathOperator{\disc}{disc}
273\DeclareMathOperator{\fl}{fl} % Representación en coma flotante
274\DeclareMathOperator{\sgn}{sgn} % Función signo (sgn) de una permutación
275\DeclareMathOperator{\diag}{diag} % Notación corta para matriz diagonal: diag(d_1,...,d_n)
276\DeclareMathOperator{\vspan}{span}
277% \end{macrocode}
278%
279% \subsubsection{Index}
280% \begin{macrocode}
281\newcounter{apuntsfme@index}
282\setcounter{apuntsfme@index}{1}
283\def\consume#1{}%
284\def\printcmd{\expandafter\consume\string}
285\def\idx#1{%
286 \label{apuntsfme@index:#1}%
287 \expandafter\gdef\csname indice\Roman{apuntsfme@index}\endcsname%
288 ##1{\hyperref[apuntsfme@index:#1]{##1}}%
289 \index{#1|\expandafter\printcmd\csname indice\Roman{apuntsfme@index}\endcsname}%
290 \stepcounter{apuntsfme@index}
291}
292
293\makeindex
294\RequirePackage[totoc]{idxlayout} % Glossari a l'índex
295% \end{macrocode}
296%
297% \subsection{Environments}
298% Here we define the environments in which the notes we take are based on.
299%
300% TODO add an option to the package to select the position of the number (before/after)
301% \begin{macrocode}
302\newtheoremstyle{break}% name
303{}% Space above, empty = `usual value'
304{}% Space below
305{}% Body font
306{}% Indent amount (empty = no indent, \parindent = para indent)
307{\bfseries}% Thm head font
308{}% Punctuation after thm head
309{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
310{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}\newline}}% Thm head spec
311
312\newtheoremstyle{demo}% name
313{}% Space above, empty = `usual value'
314{}% Space below
315{}% Body font
316{}% Indent amount (empty = no indent, \parindent = para indent)
317{\it}% Thm head font
318{}% Punctuation after thm head
319{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
320{#1\thmnote{ #3}.}% Thm head spec
321
322\newtheoremstyle{breakthm}% name
323{}% Space above, empty = `usual value'
324{}% Space below
325{}% Body font
326{}% Indent amount (empty = no indent, \parindent = para indent)
327{\bfseries}% Thm head font
328{}% Punctuation after thm head
329{\newline}% Space after thm head: \newline = linebreak
330{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}}\addcontentsline{toc}{subsection}{#3}}% Thm head spec
331
332\newtheoremstyle{normal}% name
333{}% Space above, empty = `usual value'
334{}% Space below
335{}% Body font
336{}% Indent amount (empty = no indent, \parindent = para indent)
337{\bfseries}% Thm head font
338{}% Punctuation after thm head
339{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
340{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}}}% Thm head spec
341
342\newtheoremstyle{autodefi}% name
343{}% Space above, empty = `usual value'
344{}% Space below
345{}% Body font
346{}% Indent amount (empty = no indent, \parindent = para indent)
347{\bfseries}% Thm head font
348{}% Punctuation after thm head
349{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
350{\index{#3((defi:#2))}\label{defi:#2}\thmname{#1}\thmnumber{ #2}.}% Thm head specko
351% \end{macrocode}
352%
353% \subsection{Options}
354% Here we have some options for the package
355%
356% \subsubsection{Babel}
357% TODO add english support and make it the default
358% \begin{macrocode}
oscarbeneditoaa0fe752019-10-01 13:13:01 +0200359\DeclareOption{numbersbefore}{
360 \newtheoremstyle{break}% name
361 {}% Space above, empty = `usual value'
362 {}% Space below
363 {}% Body font
364 {}% Indent amount (empty = no indent, \parindent = para indent)
365 {\bfseries}% Thm head font
366 {}% Punctuation after thm head
367 {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
368 {\thmnumber{#2}. \thmname{#1.}\thmnote{ {\it #3.}\newline}}% Thm head spec
369
370 \newtheoremstyle{demo}% name
371 {}% Space above, empty = `usual value'
372 {}% Space below
373 {}% Body font
374 {}% Indent amount (empty = no indent, \parindent = para indent)
375 {\it}% Thm head font
376 {}% Punctuation after thm head
377 {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
378 {#1\thmnote{ #3}.}% Thm head spec
379
380 \newtheoremstyle{breakthm}% name
381 {}% Space above, empty = `usual value'
382 {}% Space below
383 {}% Body font
384 {}% Indent amount (empty = no indent, \parindent = para indent)
385 {\bfseries}% Thm head font
386 {}% Punctuation after thm head
387 {\newline}% Space after thm head: \newline = linebreak
388 {\thmnumber{#2}. \thmname{#1.}\thmnote{ {\it #3.}}\addcontentsline{toc}{subsection}{#3}}% Thm head spec
389
390 \newtheoremstyle{normal}% name
391 {}% Space above, empty = `usual value'
392 {}% Space below
393 {}% Body font
394 {}% Indent amount (empty = no indent, \parindent = para indent)
395 {\bfseries}% Thm head font
396 {}% Punctuation after thm head
397 {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
398 {\thmnumber{#2}. \thmname{#1.}\thmnote{ {\it #3.}}}% Thm head spec
399
400 \newtheoremstyle{autodefi}% name
401 {}% Space above, empty = `usual value'
402 {}% Space below
403 {}% Body font
404 {}% Indent amount (empty = no indent, \parindent = para indent)
405 {\bfseries}% Thm head font
406 {}% Punctuation after thm head
407 {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
408 {\index{#3((defi:#2))}\label{defi:#2}\thmnumber{#2}. \thmname{#1.}}% Thm head specko
409}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200410\newif\if@babel\@babeltrue
oscarbeneditoef77d902019-09-30 19:44:52 +0200411\newcount\@babellang
412\@babellang=0
413\def\@babelopt{english}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200414\DeclareOption{nobabel}{
415 \@babelfalse
416}
oscarbeneditoef77d902019-09-30 19:44:52 +0200417\DeclareOption{catalan}{
418 \gdef\@babelopt{catalan}
419 \@babellang=1
420}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200421\DeclareOption{spanish}{
oscarbeneditoef77d902019-09-30 19:44:52 +0200422 \gdef\@babelopt{spanish,es-lcroman,es-nolists}
423 \@babellang=2
424}
425\ProcessOptions\relax
426\if@babel
427 \PassOptionsToPackage{\@babelopt}{babel}
428 \RequirePackage{babel}
429\fi
430\ifnum\@babellang=1
431 % Normal
432 \declaretheorem[style=normal,name=Lema,numberwithin=section]{lema}
433 \declaretheorem[style=normal,name=Lema,numbered=no]{lema*}
434 \declaretheorem[style=normal,name=Observació,sibling=lema]{obs}
435 \declaretheorem[style=normal,name=Observació,numbered=no]{obs*}
436 \declaretheorem[style=normal,name=Proposició,sibling=lema]{prop}
437 \declaretheorem[style=normal,name=Proposició,numbered=no]{prop*}
438 \declaretheorem[style=normal,name=Definició,sibling=lema]{defi*}
439 \declaretheorem[style=normal,name=Coro{\lgem}ari,sibling=lema]{col}
440 \declaretheorem[style=normal,name=Coro{\lgem}ari,numbered=no]{col*}
441 \declaretheorem[style=normal,name=Exercici,sibling=lema]{ej}
442 \declaretheorem[style=normal,name=Exercici,numbered=no]{ej*}
443 \declaretheorem[style=normal,name=Exemple,sibling=lema]{example}
444 \declaretheorem[style=normal,name=Exemple,numbered=no]{example*}
445 \declaretheorem[style=normal,name=Problema,sibling=lema]{problema}
446 \declaretheorem[style=normal,name=Problema,numbered=no]{problema*}
447
448 % Autodefi
449 \declaretheorem[style=autodefi,name=Definició,sibling=lema]{defi}
450
451 % Demo
452 \let\proof\relax
453 \declaretheorem[style=demo,name=Demostració,qed=$\square$,numbered=no]{proof}
454 \declaretheorem[style=demo,name=Solució,numbered=no]{sol}
455
456 % Break
457 \declaretheorem[style=break,name=Teorema,sibling=lema]{teo*}
458
459 % Breakthm
460 \declaretheorem[style=breakthm,name=Teorema,sibling=lema]{teo}
461
462 \@ifclassloaded{book}{%
463 \AtBeginDocument{\renewcommand{\chaptername}{Tema}}
464 }{}
465\fi
466\ifnum\@babellang=2
oscarbenedito6bc418b2019-09-20 13:28:57 +0200467 % Normal
468 \declaretheorem[style=normal,name=Lema,numberwithin=section]{lema}
469 \declaretheorem[style=normal,name=Lema,numbered=no]{lema*}
470 \declaretheorem[style=normal,name=Observación,sibling=lema]{obs}
471 \declaretheorem[style=normal,name=Observación,numbered=no]{obs*}
472 \declaretheorem[style=normal,name=Proposición,sibling=lema]{prop}
473 \declaretheorem[style=normal,name=Proposición,numbered=no]{prop*}
474 \declaretheorem[style=normal,name=Definición,sibling=lema]{defi*}
475 \declaretheorem[style=normal,name=Corolario,sibling=lema]{col}
476 \declaretheorem[style=normal,name=Corolario,numbered=no]{col*}
477 \declaretheorem[style=normal,name=Ejercicio,sibling=lema]{ej}
478 \declaretheorem[style=normal,name=Ejercicio,numbered=no]{ej*}
479 \declaretheorem[style=normal,name=Ejemplo,sibling=lema]{example}
480 \declaretheorem[style=normal,name=Ejemplo,numbered=no]{example*}
481 \declaretheorem[style=normal,name=Problema,sibling=lema]{problema}
482 \declaretheorem[style=normal,name=Problema,numbered=no]{problema*}
483
484 % Autodefi
485 \declaretheorem[style=autodefi,name=Definición,sibling=lema]{defi}
486
487 % Demo
488 \let\proof\relax
489 \declaretheorem[style=demo,name=Demostración,qed=$\square$,numbered=no]{proof}
490 \declaretheorem[style=demo,name=Solución,numbered=no]{sol}
491
492 % Break
493 \declaretheorem[style=break,name=Teorema,sibling=lema]{teo*}
494
495 % Breakthm
496 \declaretheorem[style=breakthm,name=Teorema,sibling=lema]{teo}
oscarbeneditoef77d902019-09-30 19:44:52 +0200497
oscarbenedito6bc418b2019-09-20 13:28:57 +0200498 \@ifclassloaded{book}{%
499 \AtBeginDocument{\renewcommand{\contentsname}{Contenidos}}
500 \AtBeginDocument{\renewcommand{\chaptername}{Tema}}
501 }{}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200502\fi
503% \end{macrocode}
504%
505% \iffalse
506%</package>
507% \fi
508% \section{Class implementation}
509% \iffalse
510%<*class>
511% \fi
512% \subsection{Imports}
513% \begin{macrocode}
514\RequirePackage[utf8]{inputenc}
515\RequirePackage[T1]{fontenc}
oscarbeneditoef77d902019-09-30 19:44:52 +0200516\RequirePackage{lmodern}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200517\RequirePackage{graphicx}
518% \end{macrocode}
519%
520% \subsection{Language}
521% The default language is english
522% \begin{macrocode}
523\newcommand*{\@authortext}{Author}
524\newcommand*{\@authorstext}{Authors}
oscarbeneditoef77d902019-09-30 19:44:52 +0200525\newcommand*{\@prauthortext}{Principal author}
526\newcommand*{\@prauthorstext}{Principal authors}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200527\newcommand*{\@otherauthortext}{Other authors}
oscarbeneditoef77d902019-09-30 19:44:52 +0200528\newcommand*{\@reviewertext}{Reviewers}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200529\newcommand*{\@lastupdatetext}{Last update}
530\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}
531\newcommand*{\titlemonth}[1]{\gdef\@titlemonth{#1}}
532
533\DeclareOption{spanish}{
534 \renewcommand*{\languagename}{spanish}
oscarbeneditoef77d902019-09-30 19:44:52 +0200535 \renewcommand*{\@authortext}{Autor}
536 \renewcommand*{\@authorstext}{Autores}
537 \renewcommand*{\@prauthortext}{Autor principal}
538 \renewcommand*{\@prauthorstext}{Autores principales}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200539 \renewcommand*{\@otherauthortext}{Otros autores}
oscarbeneditoef77d902019-09-30 19:44:52 +0200540 \renewcommand*{\@reviewertext}{Revisores}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200541 \renewcommand*{\@lastupdatetext}{\'Ultima modificaci\'on}
542 \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}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200543}
544
545\DeclareOption{catalan}{
546 \renewcommand*{\languagename}{catalan}
oscarbeneditoef77d902019-09-30 19:44:52 +0200547 \renewcommand*{\@authortext}{Autor}
548 \renewcommand*{\@authorstext}{Autors}
549 \renewcommand*{\@prauthortext}{Autor principal}
550 \renewcommand*{\@prauthorstext}{Autors principals}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200551 \renewcommand*{\@otherauthortext}{Altres autors}
oscarbeneditoef77d902019-09-30 19:44:52 +0200552 \renewcommand*{\@reviewertext}{Revisors}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200553 \renewcommand*{\@lastupdatetext}{\'Ultima modificaci\'o}
554 \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}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200555}
556% \end{macrocode}
557%
558% \subsection{Metatadata}
559% TODO creo que no funciona o algo así...
560% \begin{macrocode}
561\newcommand*{\generatemetadata}{%
562 \renewcommand*{\and}{ and }
563 \hypersetup{
564 pdfauthor={\@author}
565 }
566 \renewcommand*{\and}{ }
567 \hypersetup{
568 pdftitle={{\@title} -- ApuntsFME},
569 pdfsubject={\@title},
570 pdfkeywords={ApuntsFME},
571 }
572}
573% \end{macrocode}
574%
575% \subsection{Process options}
576% \begin{macrocode}
577\ProcessOptions\relax
578% \end{macrocode}
579%
580% \subsection{Import class}
581% Again we don't think making the whole thing from scratch was viable.
582% \begin{macrocode}
583\LoadClass[12pt]{book}
584% \end{macrocode}
585%
586% \subsection{Title page}
587% Here we create the title page, one of the strengths of this class
588%
589% \subsubsection{Last update}
590% \begin{macrocode}
591\newif\if@lastupdate\@lastupdatetrue
592\newcommand*{\nolastupdate}{\@lastupdatefalse}
593% \end{macrocode}
594%
595% \subsubsection{Authors}
596% \begin{macrocode}
597\newcommand*{\@metaauthor}{}
598
oscarbenedito6bc418b2019-09-20 13:28:57 +0200599\newcount\apuntsfme@numberauthor
600\apuntsfme@numberauthor=0
601
602\def\@author{}
603\renewcommand*{\author}[1]{%
604 \expandafter\gdef\csname apuntsfme@author\the\apuntsfme@numberauthor\endcsname{#1}%
605 \advance\apuntsfme@numberauthor by1 %
606}
607% \end{macrocode}
608%
609% \subsubsection{Other Authors}
610% \begin{macrocode}
oscarbeneditoef77d902019-09-30 19:44:52 +0200611\def\@otherauthor{}
612\newcommand*{\otherauthor}[1]{%
613 \ifx\@otherauthor\empty %
614 \gdef\@otherauthor{#1}%
615 \else%
616 \expandafter\gdef\expandafter\@otherauthor\expandafter{\@otherauthor, #1}%
617 \fi%
618}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200619% \end{macrocode}
620%
621% \subsubsection{Reviewers}
622% \begin{macrocode}
oscarbeneditoef77d902019-09-30 19:44:52 +0200623\def\@reviewer{}
624\newcommand*{\reviewer}[1]{%
625 \ifx\@reviewer\empty %
626 \gdef\@reviewer{#1}%
627 \else%
628 \expandafter\gdef\expandafter\@reviewer\expandafter{\@reviewer, #1}%
629 \fi%
630}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200631% \end{macrocode}
632%
633% \subsubsection{Subtitle}
634% \begin{macrocode}
635\newcommand*{\subtitle}[1]{\gdef\@subtitle{#1}}
636\newcommand*{\@subtitle}{}
637% \end{macrocode}
638%
639% \subsubsection{Thanks comment}
640% \begin{macrocode}
641\newcommand*{\thankscomment}[1]{\gdef\@thankscomment{#1}}
642\newcommand*{\@thankscomment}{}
643% \end{macrocode}
644%
645% \subsubsection{Title page}
646% All of the previous sections are combined here were we actually make the title page.
647% TODO remove doclicense
648% \begin{macrocode}
649\renewcommand*{\maketitle}{%
650\generatemetadata
651\begin{titlepage}
oscarbeneditoef77d902019-09-30 19:44:52 +0200652 \centering\scshape%
653 \vspace*{\fill}%
654 \rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt} %
655 \rule{\textwidth}{0.4pt} %
656
oscarbenedito6bc418b2019-09-20 13:28:57 +0200657 \vspace{0.75\baselineskip}
oscarbeneditoef77d902019-09-30 19:44:52 +0200658
659 \renewcommand*{\and}{\protect\\}%
oscarbenedito6bc418b2019-09-20 13:28:57 +0200660 {\LARGE \expandafter\MakeUppercase\expandafter{\@title}\\}
661
662 \vspace{0.75\baselineskip}
663
oscarbeneditoef77d902019-09-30 19:44:52 +0200664 \rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} %
665 \rule{\textwidth}{1.6pt} %
oscarbenedito6bc418b2019-09-20 13:28:57 +0200666
667 \vspace{1.5\baselineskip}
668
669 \@subtitle
670
671 \vspace*{\fill}
672 \vspace*{\fill}
673 \vspace*{\fill}
674 \vspace*{\fill}
675 \vspace*{\fill}
676 \vspace*{\fill}
677
678 \includegraphics[width=5cm]{../logo.pdf}
679
680 \vspace{0.3\baselineskip}
681
682 Barcelona, \@titlemonth
683\end{titlepage}
684
685\vspace*{\fill}
686
oscarbeneditoef77d902019-09-30 19:44:52 +0200687\ifnum\apuntsfme@numberauthor=0%
688\else%
689 \ifx\@otherauthor\empty %
690 \ifnum\apuntsfme@numberauthor=1%
691 \noindent \@authortext: %
692 \else%
693 \noindent \@authorstext: %
694 \fi%
695 \else%
696 \ifnum\apuntsfme@numberauthor=1%
697 \noindent \@prauthortext: %
698 \else%
699 \noindent \@prauthorstext: %
700 \fi%
701 \fi
702 \newcount\apuntsfme@tempauthor%
703 \loop%
704 \ifnum\apuntsfme@tempauthor=0 %
705 \else%
706 , %
707 \fi%
708 \csname apuntsfme@author\the\apuntsfme@tempauthor\endcsname%
709 \advance\apuntsfme@tempauthor by 1 %
710 \ifnum\apuntsfme@tempauthor < \apuntsfme@numberauthor%
711 \repeat%
712 .%
oscarbenedito6bc418b2019-09-20 13:28:57 +0200713\fi
714\ifx\@otherauthor\empty
715\else
716
717 \quad
718
719 \noindent \@otherauthortext: \@otherauthor.
720\fi
721\ifx\@reviewer\empty
722\else
723
724 \quad
725
oscarbenedito6bc418b2019-09-20 13:28:57 +0200726 \noindent \@reviewertext: \@reviewer.
727\fi
728\ifx\@thankscomment\empty
729\else
730
731 \quad
732
733 \noindent \@thankscomment
734\fi
735\if@lastupdate
736
737 \quad
738
739 \noindent \@lastupdatetext: \@date.
740\fi
741
742\doclicenseThis
743}
744% \end{macrocode}
745%
746% \subsection{Other commands}
747%
748% \begin{macro}{\makecover}
749% \begin{macrocode}
750\newcommand*{\makecover}{
751 \frontmatter
752 \maketitle
753 \tableofcontents
754 \mainmatter
755}
756% \end{macrocode}
757% \end{macro}
758%
759% \subsection{Other includes}
760% These packages need to be included last, so we place them here. TODO remove doclicense
761% \begin{macrocode}
762\RequirePackage[a4paper,margin=1in]{geometry}
763\RequirePackage{hyperref}
764\RequirePackage[
765 type={CC},
766 modifier={by-nc-sa},
767 version={4.0},
768]{doclicense}
769% \end{macrocode}
770%
771% \iffalse
772%</class>
773% \fi