blob: b5bc57223f16345116633443914da20abbecbcc4 [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}
oscarbeneditoef77d902019-09-30 19:44:52 +0200259\DeclareMathOperator{\spec}{Spec}
260\DeclareMathOperator{\Log}{Log}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200261%\DeclareMathOperator{\tr}{tr} % Already in physics
262\DeclareMathOperator{\vol}{vol}
263%\DeclareMathOperator{\grad}{grad} % Already in physics
264\DeclareMathOperator{\rot}{rot}
265\DeclareMathOperator{\diver}{div}
266\DeclareMathOperator{\sinc}{sinc}
267\DeclareMathOperator{\graf}{graf}
oscarbeneditoef77d902019-09-30 19:44:52 +0200268\DeclareMathOperator{\TQ}{\text{ tal que }}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200269\DeclareMathOperator{\tq}{\;t.q.\;}
270\DeclareMathOperator{\disc}{disc}
271\DeclareMathOperator{\fl}{fl} % Representación en coma flotante
272\DeclareMathOperator{\sgn}{sgn} % Función signo (sgn) de una permutación
273\DeclareMathOperator{\diag}{diag} % Notación corta para matriz diagonal: diag(d_1,...,d_n)
274\DeclareMathOperator{\vspan}{span}
275% \end{macrocode}
276%
277% \subsubsection{Index}
278% \begin{macrocode}
279\newcounter{apuntsfme@index}
280\setcounter{apuntsfme@index}{1}
281\def\consume#1{}%
282\def\printcmd{\expandafter\consume\string}
283\def\idx#1{%
284 \label{apuntsfme@index:#1}%
285 \expandafter\gdef\csname indice\Roman{apuntsfme@index}\endcsname%
286 ##1{\hyperref[apuntsfme@index:#1]{##1}}%
287 \index{#1|\expandafter\printcmd\csname indice\Roman{apuntsfme@index}\endcsname}%
288 \stepcounter{apuntsfme@index}
289}
290
291\makeindex
292\RequirePackage[totoc]{idxlayout} % Glossari a l'índex
293% \end{macrocode}
294%
295% \subsection{Environments}
296% Here we define the environments in which the notes we take are based on.
297%
298% TODO add an option to the package to select the position of the number (before/after)
299% \begin{macrocode}
300\newtheoremstyle{break}% name
301{}% Space above, empty = `usual value'
302{}% Space below
303{}% Body font
304{}% Indent amount (empty = no indent, \parindent = para indent)
305{\bfseries}% Thm head font
306{}% Punctuation after thm head
307{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
308{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}\newline}}% Thm head spec
309
310\newtheoremstyle{demo}% name
311{}% Space above, empty = `usual value'
312{}% Space below
313{}% Body font
314{}% Indent amount (empty = no indent, \parindent = para indent)
315{\it}% Thm head font
316{}% Punctuation after thm head
317{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
318{#1\thmnote{ #3}.}% Thm head spec
319
320\newtheoremstyle{breakthm}% name
321{}% Space above, empty = `usual value'
322{}% Space below
323{}% Body font
324{}% Indent amount (empty = no indent, \parindent = para indent)
325{\bfseries}% Thm head font
326{}% Punctuation after thm head
327{\newline}% Space after thm head: \newline = linebreak
328{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}}\addcontentsline{toc}{subsection}{#3}}% Thm head spec
329
330\newtheoremstyle{normal}% name
331{}% Space above, empty = `usual value'
332{}% Space below
333{}% Body font
334{}% Indent amount (empty = no indent, \parindent = para indent)
335{\bfseries}% Thm head font
336{}% Punctuation after thm head
337{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
338{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}}}% Thm head spec
339
340\newtheoremstyle{autodefi}% name
341{}% Space above, empty = `usual value'
342{}% Space below
343{}% Body font
344{}% Indent amount (empty = no indent, \parindent = para indent)
345{\bfseries}% Thm head font
346{}% Punctuation after thm head
347{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
348{\index{#3((defi:#2))}\label{defi:#2}\thmname{#1}\thmnumber{ #2}.}% Thm head specko
349% \end{macrocode}
350%
351% \subsection{Options}
352% Here we have some options for the package
353%
354% \subsubsection{Babel}
355% TODO add english support and make it the default
356% \begin{macrocode}
357\newif\if@babel\@babeltrue
oscarbeneditoef77d902019-09-30 19:44:52 +0200358\newcount\@babellang
359\@babellang=0
360\def\@babelopt{english}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200361\DeclareOption{nobabel}{
362 \@babelfalse
363}
oscarbeneditoef77d902019-09-30 19:44:52 +0200364\DeclareOption{catalan}{
365 \gdef\@babelopt{catalan}
366 \@babellang=1
367}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200368\DeclareOption{spanish}{
oscarbeneditoef77d902019-09-30 19:44:52 +0200369 \gdef\@babelopt{spanish,es-lcroman,es-nolists}
370 \@babellang=2
371}
372\ProcessOptions\relax
373\if@babel
374 \PassOptionsToPackage{\@babelopt}{babel}
375 \RequirePackage{babel}
376\fi
377\ifnum\@babellang=1
378 % Normal
379 \declaretheorem[style=normal,name=Lema,numberwithin=section]{lema}
380 \declaretheorem[style=normal,name=Lema,numbered=no]{lema*}
381 \declaretheorem[style=normal,name=Observació,sibling=lema]{obs}
382 \declaretheorem[style=normal,name=Observació,numbered=no]{obs*}
383 \declaretheorem[style=normal,name=Proposició,sibling=lema]{prop}
384 \declaretheorem[style=normal,name=Proposició,numbered=no]{prop*}
385 \declaretheorem[style=normal,name=Definició,sibling=lema]{defi*}
386 \declaretheorem[style=normal,name=Coro{\lgem}ari,sibling=lema]{col}
387 \declaretheorem[style=normal,name=Coro{\lgem}ari,numbered=no]{col*}
388 \declaretheorem[style=normal,name=Exercici,sibling=lema]{ej}
389 \declaretheorem[style=normal,name=Exercici,numbered=no]{ej*}
390 \declaretheorem[style=normal,name=Exemple,sibling=lema]{example}
391 \declaretheorem[style=normal,name=Exemple,numbered=no]{example*}
392 \declaretheorem[style=normal,name=Problema,sibling=lema]{problema}
393 \declaretheorem[style=normal,name=Problema,numbered=no]{problema*}
394
395 % Autodefi
396 \declaretheorem[style=autodefi,name=Definició,sibling=lema]{defi}
397
398 % Demo
399 \let\proof\relax
400 \declaretheorem[style=demo,name=Demostració,qed=$\square$,numbered=no]{proof}
401 \declaretheorem[style=demo,name=Solució,numbered=no]{sol}
402
403 % Break
404 \declaretheorem[style=break,name=Teorema,sibling=lema]{teo*}
405
406 % Breakthm
407 \declaretheorem[style=breakthm,name=Teorema,sibling=lema]{teo}
408
409 \@ifclassloaded{book}{%
410 \AtBeginDocument{\renewcommand{\chaptername}{Tema}}
411 }{}
412\fi
413\ifnum\@babellang=2
oscarbenedito6bc418b2019-09-20 13:28:57 +0200414 % Normal
415 \declaretheorem[style=normal,name=Lema,numberwithin=section]{lema}
416 \declaretheorem[style=normal,name=Lema,numbered=no]{lema*}
417 \declaretheorem[style=normal,name=Observación,sibling=lema]{obs}
418 \declaretheorem[style=normal,name=Observación,numbered=no]{obs*}
419 \declaretheorem[style=normal,name=Proposición,sibling=lema]{prop}
420 \declaretheorem[style=normal,name=Proposición,numbered=no]{prop*}
421 \declaretheorem[style=normal,name=Definición,sibling=lema]{defi*}
422 \declaretheorem[style=normal,name=Corolario,sibling=lema]{col}
423 \declaretheorem[style=normal,name=Corolario,numbered=no]{col*}
424 \declaretheorem[style=normal,name=Ejercicio,sibling=lema]{ej}
425 \declaretheorem[style=normal,name=Ejercicio,numbered=no]{ej*}
426 \declaretheorem[style=normal,name=Ejemplo,sibling=lema]{example}
427 \declaretheorem[style=normal,name=Ejemplo,numbered=no]{example*}
428 \declaretheorem[style=normal,name=Problema,sibling=lema]{problema}
429 \declaretheorem[style=normal,name=Problema,numbered=no]{problema*}
430
431 % Autodefi
432 \declaretheorem[style=autodefi,name=Definición,sibling=lema]{defi}
433
434 % Demo
435 \let\proof\relax
436 \declaretheorem[style=demo,name=Demostración,qed=$\square$,numbered=no]{proof}
437 \declaretheorem[style=demo,name=Solución,numbered=no]{sol}
438
439 % Break
440 \declaretheorem[style=break,name=Teorema,sibling=lema]{teo*}
441
442 % Breakthm
443 \declaretheorem[style=breakthm,name=Teorema,sibling=lema]{teo}
oscarbeneditoef77d902019-09-30 19:44:52 +0200444
oscarbenedito6bc418b2019-09-20 13:28:57 +0200445 \@ifclassloaded{book}{%
446 \AtBeginDocument{\renewcommand{\contentsname}{Contenidos}}
447 \AtBeginDocument{\renewcommand{\chaptername}{Tema}}
448 }{}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200449\fi
450% \end{macrocode}
451%
452% \iffalse
453%</package>
454% \fi
455% \section{Class implementation}
456% \iffalse
457%<*class>
458% \fi
459% \subsection{Imports}
460% \begin{macrocode}
461\RequirePackage[utf8]{inputenc}
462\RequirePackage[T1]{fontenc}
oscarbeneditoef77d902019-09-30 19:44:52 +0200463\RequirePackage{lmodern}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200464\RequirePackage{graphicx}
465% \end{macrocode}
466%
467% \subsection{Language}
468% The default language is english
469% \begin{macrocode}
470\newcommand*{\@authortext}{Author}
471\newcommand*{\@authorstext}{Authors}
oscarbeneditoef77d902019-09-30 19:44:52 +0200472\newcommand*{\@prauthortext}{Principal author}
473\newcommand*{\@prauthorstext}{Principal authors}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200474\newcommand*{\@otherauthortext}{Other authors}
oscarbeneditoef77d902019-09-30 19:44:52 +0200475\newcommand*{\@reviewertext}{Reviewers}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200476\newcommand*{\@lastupdatetext}{Last update}
477\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}
478\newcommand*{\titlemonth}[1]{\gdef\@titlemonth{#1}}
479
480\DeclareOption{spanish}{
481 \renewcommand*{\languagename}{spanish}
oscarbeneditoef77d902019-09-30 19:44:52 +0200482 \renewcommand*{\@authortext}{Autor}
483 \renewcommand*{\@authorstext}{Autores}
484 \renewcommand*{\@prauthortext}{Autor principal}
485 \renewcommand*{\@prauthorstext}{Autores principales}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200486 \renewcommand*{\@otherauthortext}{Otros autores}
oscarbeneditoef77d902019-09-30 19:44:52 +0200487 \renewcommand*{\@reviewertext}{Revisores}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200488 \renewcommand*{\@lastupdatetext}{\'Ultima modificaci\'on}
489 \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 +0200490}
491
492\DeclareOption{catalan}{
493 \renewcommand*{\languagename}{catalan}
oscarbeneditoef77d902019-09-30 19:44:52 +0200494 \renewcommand*{\@authortext}{Autor}
495 \renewcommand*{\@authorstext}{Autors}
496 \renewcommand*{\@prauthortext}{Autor principal}
497 \renewcommand*{\@prauthorstext}{Autors principals}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200498 \renewcommand*{\@otherauthortext}{Altres autors}
oscarbeneditoef77d902019-09-30 19:44:52 +0200499 \renewcommand*{\@reviewertext}{Revisors}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200500 \renewcommand*{\@lastupdatetext}{\'Ultima modificaci\'o}
501 \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 +0200502}
503% \end{macrocode}
504%
505% \subsection{Metatadata}
506% TODO creo que no funciona o algo así...
507% \begin{macrocode}
508\newcommand*{\generatemetadata}{%
509 \renewcommand*{\and}{ and }
510 \hypersetup{
511 pdfauthor={\@author}
512 }
513 \renewcommand*{\and}{ }
514 \hypersetup{
515 pdftitle={{\@title} -- ApuntsFME},
516 pdfsubject={\@title},
517 pdfkeywords={ApuntsFME},
518 }
519}
520% \end{macrocode}
521%
522% \subsection{Process options}
523% \begin{macrocode}
524\ProcessOptions\relax
525% \end{macrocode}
526%
527% \subsection{Import class}
528% Again we don't think making the whole thing from scratch was viable.
529% \begin{macrocode}
530\LoadClass[12pt]{book}
531% \end{macrocode}
532%
533% \subsection{Title page}
534% Here we create the title page, one of the strengths of this class
535%
536% \subsubsection{Last update}
537% \begin{macrocode}
538\newif\if@lastupdate\@lastupdatetrue
539\newcommand*{\nolastupdate}{\@lastupdatefalse}
540% \end{macrocode}
541%
542% \subsubsection{Authors}
543% \begin{macrocode}
544\newcommand*{\@metaauthor}{}
545
oscarbenedito6bc418b2019-09-20 13:28:57 +0200546\newcount\apuntsfme@numberauthor
547\apuntsfme@numberauthor=0
548
549\def\@author{}
550\renewcommand*{\author}[1]{%
551 \expandafter\gdef\csname apuntsfme@author\the\apuntsfme@numberauthor\endcsname{#1}%
552 \advance\apuntsfme@numberauthor by1 %
553}
554% \end{macrocode}
555%
556% \subsubsection{Other Authors}
557% \begin{macrocode}
oscarbeneditoef77d902019-09-30 19:44:52 +0200558\def\@otherauthor{}
559\newcommand*{\otherauthor}[1]{%
560 \ifx\@otherauthor\empty %
561 \gdef\@otherauthor{#1}%
562 \else%
563 \expandafter\gdef\expandafter\@otherauthor\expandafter{\@otherauthor, #1}%
564 \fi%
565}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200566% \end{macrocode}
567%
568% \subsubsection{Reviewers}
569% \begin{macrocode}
oscarbeneditoef77d902019-09-30 19:44:52 +0200570\def\@reviewer{}
571\newcommand*{\reviewer}[1]{%
572 \ifx\@reviewer\empty %
573 \gdef\@reviewer{#1}%
574 \else%
575 \expandafter\gdef\expandafter\@reviewer\expandafter{\@reviewer, #1}%
576 \fi%
577}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200578% \end{macrocode}
579%
580% \subsubsection{Subtitle}
581% \begin{macrocode}
582\newcommand*{\subtitle}[1]{\gdef\@subtitle{#1}}
583\newcommand*{\@subtitle}{}
584% \end{macrocode}
585%
586% \subsubsection{Thanks comment}
587% \begin{macrocode}
588\newcommand*{\thankscomment}[1]{\gdef\@thankscomment{#1}}
589\newcommand*{\@thankscomment}{}
590% \end{macrocode}
591%
592% \subsubsection{Title page}
593% All of the previous sections are combined here were we actually make the title page.
594% TODO remove doclicense
595% \begin{macrocode}
596\renewcommand*{\maketitle}{%
597\generatemetadata
598\begin{titlepage}
oscarbeneditoef77d902019-09-30 19:44:52 +0200599 \centering\scshape%
600 \vspace*{\fill}%
601 \rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt} %
602 \rule{\textwidth}{0.4pt} %
603
oscarbenedito6bc418b2019-09-20 13:28:57 +0200604 \vspace{0.75\baselineskip}
oscarbeneditoef77d902019-09-30 19:44:52 +0200605
606 \renewcommand*{\and}{\protect\\}%
oscarbenedito6bc418b2019-09-20 13:28:57 +0200607 {\LARGE \expandafter\MakeUppercase\expandafter{\@title}\\}
608
609 \vspace{0.75\baselineskip}
610
oscarbeneditoef77d902019-09-30 19:44:52 +0200611 \rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} %
612 \rule{\textwidth}{1.6pt} %
oscarbenedito6bc418b2019-09-20 13:28:57 +0200613
614 \vspace{1.5\baselineskip}
615
616 \@subtitle
617
618 \vspace*{\fill}
619 \vspace*{\fill}
620 \vspace*{\fill}
621 \vspace*{\fill}
622 \vspace*{\fill}
623 \vspace*{\fill}
624
625 \includegraphics[width=5cm]{../logo.pdf}
626
627 \vspace{0.3\baselineskip}
628
629 Barcelona, \@titlemonth
630\end{titlepage}
631
632\vspace*{\fill}
633
oscarbeneditoef77d902019-09-30 19:44:52 +0200634\ifnum\apuntsfme@numberauthor=0%
635\else%
636 \ifx\@otherauthor\empty %
637 \ifnum\apuntsfme@numberauthor=1%
638 \noindent \@authortext: %
639 \else%
640 \noindent \@authorstext: %
641 \fi%
642 \else%
643 \ifnum\apuntsfme@numberauthor=1%
644 \noindent \@prauthortext: %
645 \else%
646 \noindent \@prauthorstext: %
647 \fi%
648 \fi
649 \newcount\apuntsfme@tempauthor%
650 \loop%
651 \ifnum\apuntsfme@tempauthor=0 %
652 \else%
653 , %
654 \fi%
655 \csname apuntsfme@author\the\apuntsfme@tempauthor\endcsname%
656 \advance\apuntsfme@tempauthor by 1 %
657 \ifnum\apuntsfme@tempauthor < \apuntsfme@numberauthor%
658 \repeat%
659 .%
oscarbenedito6bc418b2019-09-20 13:28:57 +0200660\fi
661\ifx\@otherauthor\empty
662\else
663
664 \quad
665
666 \noindent \@otherauthortext: \@otherauthor.
667\fi
668\ifx\@reviewer\empty
669\else
670
671 \quad
672
oscarbenedito6bc418b2019-09-20 13:28:57 +0200673 \noindent \@reviewertext: \@reviewer.
674\fi
675\ifx\@thankscomment\empty
676\else
677
678 \quad
679
680 \noindent \@thankscomment
681\fi
682\if@lastupdate
683
684 \quad
685
686 \noindent \@lastupdatetext: \@date.
687\fi
688
689\doclicenseThis
690}
691% \end{macrocode}
692%
693% \subsection{Other commands}
694%
695% \begin{macro}{\makecover}
696% \begin{macrocode}
697\newcommand*{\makecover}{
698 \frontmatter
699 \maketitle
700 \tableofcontents
701 \mainmatter
702}
703% \end{macrocode}
704% \end{macro}
705%
706% \subsection{Other includes}
707% These packages need to be included last, so we place them here. TODO remove doclicense
708% \begin{macrocode}
709\RequirePackage[a4paper,margin=1in]{geometry}
710\RequirePackage{hyperref}
711\RequirePackage[
712 type={CC},
713 modifier={by-nc-sa},
714 version={4.0},
715]{doclicense}
716% \end{macrocode}
717%
718% \iffalse
719%</class>
720% \fi