blob: 2710370bcbf5e6fe67c19b6ef9acc3263bac80c2 [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}
Ernesto Lanchares0641d3d2019-10-01 19:39:23 +020039\usepackage{booktabs}
40\usepackage{longtable}
oscarbenedito6bc418b2019-09-20 13:28:57 +020041\EnableCrossrefs
42\CodelineIndex
43\RecordChanges
44\begin{document}
45 \DocInput{apuntsfme.dtx}
46\end{document}
47%</driver>
48% \fi
49%
Ernesto Lanchares0641d3d2019-10-01 19:39:23 +020050% \CheckSum{0}
oscarbenedito6bc418b2019-09-20 13:28:57 +020051%
52% \CharacterTable
53% {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
54% 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
55% Digits \0\1\2\3\4\5\6\7\8\9
56% Exclamation \! Double quote \" Hash (number) \#
57% Dollar \$ Percent \% Ampersand \&
58% Acute accent \' Left paren \( Right paren \)
59% Asterisk \* Plus \+ Comma \,
60% Minus \- Point \. Solidus \/
61% Colon \: Semicolon \; Less than \<
62% Equals \= Greater than \> Question mark \?
63% Commercial at \@ Left bracket \[ Backslash \\
64% Right bracket \] Circumflex \^ Underscore \_
65% Grave accent \` Left brace \{ Vertical bar \|
66% Right brace \} Tilde \~}
67%
68% \changes{v1.0}{2019/07/14}{Initial version}
69%
70% \GetFileInfo{apuntsfme.sty}
oscarbenedito6bc418b2019-09-20 13:28:57 +020071%
72%
73% \title{The \textsf{ApuntsFME} package\thanks{This document
74% corresponds to \textsf{apuntsfme}~\fileversion,
75% dated~\filedate.}}
oscarbenedito491ae192020-03-22 12:33:36 +010076% \author{Ernesto Lanchares\\ \href{mailto:e.lancha98@gmail.com}{e.lancha98@gmail.com} \and Oscar Benedito \\ \href{mailto:oscar@oscarbenedito.com}{oscar@oscarbenedito.com}}
oscarbenedito6bc418b2019-09-20 13:28:57 +020077%
78% \maketitle
79%
80% \begin{abstract}
81% A package that aims to make taking notes in math class in \LaTeX\ easy.
82% \end{abstract}
83%
Ernesto Lanchares0641d3d2019-10-01 19:39:23 +020084% The goal of this package is make taking notes on class easy. It includes a lot of packages and shortcuts
85% that aim to make it easy to remember and easy to type. Note that this package is not meant to set a
86% reference in how \LaTeX\ should be writter nor it's meant to be a guideline of any kind.
87%
88% \section{The ApuntsFME package}
89% The ApuntsFME package has the purpose of providing the shortcuts and
90% environments used for short typing.
91%
92% \subsection{Packages imported}
93% As mentioned, this package collects a lot of other packages all very common to math typing. Here's a
94% table with all of them and the use that they provide.
95%
96% \begin{longtable}{p{.2\textwidth}p{.6\textwidth}}
97% Package & Usage \\ \toprule \toprule
98% \endhead
99% \bottomrule \multicolumn{2}{c}{{Continued on next page}} \\
100% \endfoot
101% \bottomrule
102% \endlastfoot
103% inputenc & loaded with the \texttt{utf-8} option, used so the characters
104% are interpreted as unicode text \\ \midrule
105% fontenc & loaded with the \texttt{T1} option. It's used so, in the output
106% PDF, you can search for accented words \\ \midrule
107% lmodern & To have the fonts have high quality \\ \midrule
108% hyperref & To have clickable links and urls \\ \midrule
109% enumitem & loaded with \texttt{shortlabels}. Used to control enumerates \\
110% \midrule
111% amsmath & The American Mathematical Society \LaTeX\ package. Loads common
112% math utilities \\ \midrule
113% amsthm & The American Mathematical Society package used to typeset
114% theorems, propositions, \dots \\ \midrule
115% amssymb & The American Mathematical Society pacakgae that defines a lot of
116% ``common'' symbols \\ \midrule
117% graphicx & A lot of support for graphics inside the document \\ \midrule
118% mathtools & A set of mathematical tools. \\ \midrule
119% tikz & A package to create graphics inside \LaTeX. \\ \midrule
120% makeidx & This is what creates the glossary with the definitions. \\
121% \midrule
122% cancel & This package allows to cancel things in equations by marking them
123% with a line (just as you would do in a paper) \\ \midrule
124% pgf & Is the backend of \texttt{pgfplots} \\ \midrule
125% pgfplots & This is used with \texttt{tikz} to make axis plots \\ \midrule
126% mathrsfs & Support for using RSFS fonts in maths \\ \midrule
127% thmtools & This is used to furder customize the \texttt{amsthm}
128% environments \\ \midrule
129% tikz-cd & An extension of \texttt{tikz} to create commutative diagrams \\
130% \midrule
131% faktor & Used to typeset quotient structures \\ \midrule
132% physics & More macros for maths \\ \midrule
133% float & Let's you controll the figures position \\ \midrule
134% \end{longtable}
135%
136% It's interesting to note that we load TiKz and PGF because we bet for making
137% the figures inside \LaTeX\ and not with another external tool. However, this
MiquelOrtega559b67d2020-07-20 19:03:28 +0200138% has a drawback and is that it increases compilation times by quite a lot. To
139% mitigate this effect we also use \texttt{external} with TiKz. This library,
Ernesto Lanchares0641d3d2019-10-01 19:39:23 +0200140% makes the first computation very very slow and creates a directory with all
141% the figures generated from the code. Then, the rest of the compilations just
142% need to import that precomputed figure so they are a lot faster. This
143% behaviour can be turned off by the \texttt{noexternal} option.
144%
MiquelOrtega559b67d2020-07-20 19:03:28 +0200145% You can also control the output folder of these figures with the option
146% \texttt{externalfolder}. Here's an example of how to put the figures in the
Ernesto Lanchares0641d3d2019-10-01 19:39:23 +0200147% folder myfigures. But remember that this option will be ignored if you use
148% \texttt{noexternal}.
149%
150% \begin{verbatim}
151% \usepackage[externalfolder=myfigures]{apuntsfme}
152% \end{verbatim}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200153%
154% \StopEventually{}
155%
156% \section{Package implementation}
157% \iffalse
158%<*package>
159% \fi
160% \subsection{Includes}
161%
162% In the first place, we need to import some other packages (in fact, a lot of them). We
163% considered that there's no need in reinventing the wheel so our work is based on this packages
164%
165% \begin{macrocode}
166\RequirePackage[utf8]{inputenc}
167\RequirePackage[T1]{fontenc}
oscarbeneditoef77d902019-09-30 19:44:52 +0200168\RequirePackage{lmodern}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200169\RequirePackage[shortlabels]{enumitem}
170\RequirePackage{amsmath,amsthm,amssymb,graphicx,mathtools,tikz,makeidx}
171\RequirePackage{cancel,pgf,pgfplots,mathrsfs,thmtools,tikz-cd,faktor}
Ernesto Lanchares0641d3d2019-10-01 19:39:23 +0200172\RequirePackage{physics,float}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200173% \end{macrocode}
174%
oscarbenedito6bc418b2019-09-20 13:28:57 +0200175% Then we have lots of packages that we want to remove but have some documents that use them
176% so we don't remove them because laziness.
177% \begin{macrocode}
178\RequirePackage{xfrac} % Fa els sfrac, per cert un a multi esta malamanet??
179\RequirePackage{siunitx} %Crec que cal canviar codi
180\RequirePackage{centernot} % Aixo es exclusiu d'estructures per fer un \not concret als mid?
181\RequirePackage{multicol} % Exclusiu dels formularis?
182\RequirePackage{xcolor} % Aixo potser es d'un document concret
183\RequirePackage{needspace} %No se si es gaire util, compila sense incloure'l
184\RequirePackage{commath} % Aquest implement els \dif, cal canviar tot el codi per ferho amb physics
oscarbenedito6bc418b2019-09-20 13:28:57 +0200185\RequirePackage{dsfont} % No se que fa, compila si el trec
MiquelOrtega9872c512020-04-22 00:40:41 +0200186\RequirePackage{mdframed,stackengine,stmaryrd,multirow}
Miquel Ortegaad3be8a2020-10-06 10:51:49 +0100187\PassOptionsToPackage{unicode}{hyperref}
MiquelOrtega9872c512020-04-22 00:40:41 +0200188\RequirePackage{hyperref, cleveref}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200189% \end{macrocode}
190%
Ernesto Lanchares0641d3d2019-10-01 19:39:23 +0200191%
192% And some style definitions, just because we can.
193% \begin{macrocode}
194\let\emptyset\varnothing
195\setcounter{secnumdepth}{4}
196\def\mydate{\today}
197\hypersetup{
198 colorlinks,
199 linkcolor=blue
200}
201% \end{macrocode}
202%
MiquelOrtega559b67d2020-07-20 19:03:28 +0200203% \subsection{Conflict fixes}
204% In this section we fix conflicts between loaded packages. As of now, we only
205% fix a spurious warning when using boldsymbol and stmaryrd. See
206% \url{https://tex.stackexchange.com/questions/106714/stmaryrd-and-boldsymbol-avoid-warnings}
207% \begin{macrocode}
208\SetSymbolFont{stmry}{bold}{U}{stmry}{m}{n}
209% \end{macrocode}
210%
oscarbenedito6bc418b2019-09-20 13:28:57 +0200211% \subsection{Useful commands}
212% In this section we provide some useful commands.
213%
214% We start with some commands that need to be removed but again, laziness
215% \begin{macrocode}
216%\newcommand{\ap}[1]{\ensuremath\overline{#1}}
217%\newcommand{\Sup}[1]{\ensuremath\underset{#1}{\sup}}
218%\newcommand{\Max}[1]{\ensuremath\underset{#1}{\max}}
219%\newcommand{\Min}[1]{\ensuremath\underset{#1}{\min}}
220%\newcommand{\scin}[1]{\ensuremath\SI{#1}{}}
221\newcommand\comp[1]{\overline{#1}} % Treure? #SouUnsVagos
222\newcommand\inv[1]{#1^{-1}} % Habra que sacarlo de algun documento?
223\newcommand{\ita}[1]{\textit{#1}} % Habra que sacarlo de algun documento?
224\newmdenv[leftline=false,topline=false]{topright}
225% \end{macrocode}
226%
227% Now we can proceed into the part that we are proud of. First some commands
228% \begin{macrocode}
229%\newcommand\mapsfrom{\mathrel{\reflectbox{\ensuremath{\mapsto}}}} %Already defined?
230\newcommand*{\bimplies}{\boxed{\implies}}
231\newcommand*{\bimpliedby}{\boxed{\impliedby}}
232% \end{macrocode}
233%
234% \subsubsection{Mathbb commands}
235% Again, with some parts that needs removing/refactoring
236% \begin{macrocode}
237\newcommand{\n}{\mathbb{N}}
238\newcommand{\z}{\mathbb{Z}}
239\newcommand{\q}{\mathbb{Q}}
240\newcommand{\cx}{\mathbb{C}}
241\renewcommand{\real}{\mathbb{R}}
242\newcommand{\E}{\mathbb{E}}
243\newcommand{\F}{\mathbb{F}}
244\newcommand{\A}{\mathbb{A}}
245\newcommand{\bb}[1]{\mathbb{#1}}
246\newcommand{\Po}{\mathbb{P}}
247\newcommand{\esp}{\mathbb{E}}
248\DeclareMathOperator{\cov}{\mathbb{C}ov} % TODO esto que?
249\let\var\relax
250\DeclareMathOperator{\var}{\mathbb{V}ar} % TODO esto que?
251% \end{macrocode}
252%
253% \subsubsection{Mathcal commands}
254%
255% \begin{macrocode}
256\newcommand{\R}{\mathcal{R}}
257\newcommand{\Pa}{\mathcal{P}}
258\newcommand{\Es}{\mathcal{E}}
259\newcommand{\V}{\mathcal{V}}
260\newcommand{\T}{\mathcal{T}}
261\newcommand{\B}{\mathcal{B}}
262\let\O\relax
263\newcommand{\O}{\mathcal{O}}
264\newcommand{\Sim}{\mathcal{S}}
265\newcommand{\Asim}{\mathcal{A}} % TODO aquest i el dabaix son el mateix
266\newcommand{\Asuc}{\mathcal{A}} % Conjunt de successos
267\newcommand{\matspace}{\mathcal{M}} %Espai de matrius
268% \end{macrocode}
269%
270% \subsubsection{Mathscr and others}
Miquel Ortegaad3be8a2020-10-06 10:51:49 +0100271% Hyperref unicode uses \C, therefore we renew \C for backwards compatibility.
oscarbenedito6bc418b2019-09-20 13:28:57 +0200272% \begin{macrocode}
Miquel Ortegaad3be8a2020-10-06 10:51:49 +0100273\renewcommand{\C}{\mathscr{C}}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200274\let\k\relax
275\newcommand{\k}{\Bbbk}
276% \end{macrocode}
277%
278% \subsubsection{Math utilities}
279% \begin{macrocode}
280\newcommand{\trir}{\triangleright}
281\newcommand{\tril}{\triangleleft}
282\newcommand{\limvar}[2]{\lim\limits_{#1 \rightarrow #2}} % Para escribir limites más rapido
283\newcommand{\notimplies}{\mathrel{{\ooalign{\hidewidth$\not\phantom{=}$%
284 \hidewidth\cr$\implies$}}}}
285\newcommand{\defeq}{\stackrel{\text{\tiny def}}{=}} % Símbol 'definit com'
286\def\upint{\mathchoice%
287 {\mkern13mu\overline{\vphantom{\intop}\mkern7mu}\mkern-20mu}%
288 {\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
289 {\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
290 {\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
291 \int}
292\def\lowint{\mkern3mu\underline{\vphantom{\intop}\mkern7mu}\mkern-10mu\int}
293% \end{macrocode}
294%
295% \subsubsection{Left-right thing}
296% For good practice this ones should be removed but hey using an IDE with macro insertion
297% is aparently very difficult...
298% \begin{macrocode}
299\newcommand\setb[1]{\left\{#1\right\}} % Deberia irse?
300\newcommand{\vbrack}[1]{\langle #1\rangle}
301\newcommand{\spr}[1]{\langle #1 \rangle} % TODO aquest i lanterior son el mateix
302\newcommand{\lp}{\left(}
303\newcommand{\rp}{\right)}
304\newcommand{\lc}{\left\{}
305\newcommand{\rc}{\right\}}
306\newcommand{\lb}{\left[}
307\newcommand{\rb}{\right]}
308% \end{macrocode}
309%
310% \subsubsection{Math operators}
311% \begin{macrocode}
312\DeclareMathOperator{\Ec}{Ec}
313\DeclareMathOperator{\Ep}{Ep}
314\DeclareMathOperator{\orden}{o}
315\DeclareMathOperator{\ord}{ord}
316\DeclareMathOperator{\card}{card}
317\DeclareMathOperator{\mcm}{mcm}
318\DeclareMathOperator{\mcd}{mcd}
oscarbeneditoef77d902019-09-30 19:44:52 +0200319\DeclareMathOperator{\lcm}{lcm}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200320\DeclareMathOperator{\Em}{Em}
321\DeclareMathOperator*{\argmax}{arg\,max}
322\DeclareMathOperator*{\argmin}{arg\,min}
323\DeclareMathOperator{\fr}{Fr}
324\DeclareMathOperator{\Id}{Id}
325\DeclareMathOperator{\ext}{Ext}
326\DeclareMathOperator{\inte}{Int}
327\DeclareMathOperator{\rie}{Rie}
328\DeclareMathOperator{\rg}{rg}
329\DeclareMathOperator{\gr}{gr}
330\DeclareMathOperator{\nuc}{Nuc}
331\DeclareMathOperator{\car}{car}
332\DeclareMathOperator{\im}{Im}
oscarbeneditoaa0fe752019-10-01 13:13:01 +0200333\DeclareMathOperator{\re}{Re}
oscarbeneditoef77d902019-09-30 19:44:52 +0200334\DeclareMathOperator{\spec}{Spec}
335\DeclareMathOperator{\Log}{Log}
oscarbeneditoaa0fe752019-10-01 13:13:01 +0200336\DeclareMathOperator{\Arg}{Arg}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200337%\DeclareMathOperator{\tr}{tr} % Already in physics
338\DeclareMathOperator{\vol}{vol}
339%\DeclareMathOperator{\grad}{grad} % Already in physics
340\DeclareMathOperator{\rot}{rot}
341\DeclareMathOperator{\diver}{div}
342\DeclareMathOperator{\sinc}{sinc}
343\DeclareMathOperator{\graf}{graf}
oscarbeneditoef77d902019-09-30 19:44:52 +0200344\DeclareMathOperator{\TQ}{\text{ tal que }}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200345\DeclareMathOperator{\tq}{\;t.q.\;}
346\DeclareMathOperator{\disc}{disc}
347\DeclareMathOperator{\fl}{fl} % Representación en coma flotante
348\DeclareMathOperator{\sgn}{sgn} % Función signo (sgn) de una permutación
349\DeclareMathOperator{\diag}{diag} % Notación corta para matriz diagonal: diag(d_1,...,d_n)
350\DeclareMathOperator{\vspan}{span}
351% \end{macrocode}
352%
353% \subsubsection{Index}
354% \begin{macrocode}
355\newcounter{apuntsfme@index}
356\setcounter{apuntsfme@index}{1}
357\def\consume#1{}%
358\def\printcmd{\expandafter\consume\string}
359\def\idx#1{%
Ernesto Lanchares5a818342019-10-16 16:22:34 +0200360 \edef\apuntsfme@tmp{apuntsfme@index:\Roman{apuntsfme@index}}%
361 \expandafter\label\expandafter{\apuntsfme@tmp}%
362 \expandafter\xdef\csname indice\Roman{apuntsfme@index}\endcsname%
Ernesto Lanchares09dc48e2019-10-16 16:32:05 +0200363 ##1{\noexpand\hyperref[apuntsfme@index:\Roman{apuntsfme@index}]{##1}}%
oscarbenedito6bc418b2019-09-20 13:28:57 +0200364 \index{#1|\expandafter\printcmd\csname indice\Roman{apuntsfme@index}\endcsname}%
Ernesto Lanchares5a818342019-10-16 16:22:34 +0200365 \stepcounter{apuntsfme@index}%
oscarbenedito6bc418b2019-09-20 13:28:57 +0200366}
367
368\makeindex
369\RequirePackage[totoc]{idxlayout} % Glossari a l'índex
370% \end{macrocode}
371%
372% \subsection{Environments}
373% Here we define the environments in which the notes we take are based on.
374%
375% TODO add an option to the package to select the position of the number (before/after)
376% \begin{macrocode}
377\newtheoremstyle{break}% name
378{}% Space above, empty = `usual value'
379{}% Space below
380{}% Body font
381{}% Indent amount (empty = no indent, \parindent = para indent)
382{\bfseries}% Thm head font
383{}% Punctuation after thm head
384{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
385{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}\newline}}% Thm head spec
386
387\newtheoremstyle{demo}% name
388{}% Space above, empty = `usual value'
389{}% Space below
390{}% Body font
391{}% Indent amount (empty = no indent, \parindent = para indent)
392{\it}% Thm head font
393{}% Punctuation after thm head
394{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
395{#1\thmnote{ #3}.}% Thm head spec
396
397\newtheoremstyle{breakthm}% name
398{}% Space above, empty = `usual value'
399{}% Space below
400{}% Body font
401{}% Indent amount (empty = no indent, \parindent = para indent)
402{\bfseries}% Thm head font
403{}% Punctuation after thm head
404{\newline}% Space after thm head: \newline = linebreak
405{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}}\addcontentsline{toc}{subsection}{#3}}% Thm head spec
406
407\newtheoremstyle{normal}% name
408{}% Space above, empty = `usual value'
409{}% Space below
410{}% Body font
411{}% Indent amount (empty = no indent, \parindent = para indent)
412{\bfseries}% Thm head font
413{}% Punctuation after thm head
414{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
415{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}}}% Thm head spec
416
417\newtheoremstyle{autodefi}% name
418{}% Space above, empty = `usual value'
419{}% Space below
420{}% Body font
421{}% Indent amount (empty = no indent, \parindent = para indent)
422{\bfseries}% Thm head font
423{}% Punctuation after thm head
424{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
Ernesto Lanchares1c675712019-10-16 16:24:43 +0200425{\idx{#3}\thmname{#1}\thmnumber{ #2}.}% Thm head specko
oscarbenedito6bc418b2019-09-20 13:28:57 +0200426% \end{macrocode}
427%
428% \subsection{Options}
429% Here we have some options for the package
430%
431% \subsubsection{Babel}
432% TODO add english support and make it the default
433% \begin{macrocode}
oscarbeneditoaa0fe752019-10-01 13:13:01 +0200434\DeclareOption{numbersbefore}{
435 \newtheoremstyle{break}% name
436 {}% Space above, empty = `usual value'
437 {}% Space below
438 {}% Body font
439 {}% Indent amount (empty = no indent, \parindent = para indent)
440 {\bfseries}% Thm head font
441 {}% Punctuation after thm head
442 {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
443 {\thmnumber{#2}. \thmname{#1.}\thmnote{ {\it #3.}\newline}}% Thm head spec
444
445 \newtheoremstyle{demo}% name
446 {}% Space above, empty = `usual value'
447 {}% Space below
448 {}% Body font
449 {}% Indent amount (empty = no indent, \parindent = para indent)
450 {\it}% Thm head font
451 {}% Punctuation after thm head
452 {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
453 {#1\thmnote{ #3}.}% Thm head spec
454
455 \newtheoremstyle{breakthm}% name
456 {}% Space above, empty = `usual value'
457 {}% Space below
458 {}% Body font
459 {}% Indent amount (empty = no indent, \parindent = para indent)
460 {\bfseries}% Thm head font
461 {}% Punctuation after thm head
462 {\newline}% Space after thm head: \newline = linebreak
463 {\thmnumber{#2}. \thmname{#1.}\thmnote{ {\it #3.}}\addcontentsline{toc}{subsection}{#3}}% Thm head spec
464
465 \newtheoremstyle{normal}% name
466 {}% Space above, empty = `usual value'
467 {}% Space below
468 {}% Body font
469 {}% Indent amount (empty = no indent, \parindent = para indent)
470 {\bfseries}% Thm head font
471 {}% Punctuation after thm head
472 {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
473 {\thmnumber{#2}. \thmname{#1.}\thmnote{ {\it #3.}}}% Thm head spec
474
475 \newtheoremstyle{autodefi}% name
476 {}% Space above, empty = `usual value'
477 {}% Space below
478 {}% Body font
479 {}% Indent amount (empty = no indent, \parindent = para indent)
480 {\bfseries}% Thm head font
481 {}% Punctuation after thm head
482 {5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
System Userd832fce2019-11-18 11:49:30 +0100483 {\idx{#3}\label{defi:#2}\thmnumber{#2}. \thmname{#1.}}% Thm head specko
oscarbeneditoaa0fe752019-10-01 13:13:01 +0200484}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200485\newif\if@babel\@babeltrue
oscarbeneditoef77d902019-09-30 19:44:52 +0200486\newcount\@babellang
487\@babellang=0
488\def\@babelopt{english}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200489\DeclareOption{nobabel}{
490 \@babelfalse
491}
oscarbeneditoef77d902019-09-30 19:44:52 +0200492\DeclareOption{catalan}{
493 \gdef\@babelopt{catalan}
494 \@babellang=1
495}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200496\DeclareOption{spanish}{
oscarbeneditoef77d902019-09-30 19:44:52 +0200497 \gdef\@babelopt{spanish,es-lcroman,es-nolists}
498 \@babellang=2
499}
Ernesto Lanchares29b298b2019-10-01 19:41:04 +0200500% \end{macrocode}
501%
Ernesto Lanchares0641d3d2019-10-01 19:39:23 +0200502% Then, we need to configure TiKz and PGF
503% \begin{macrocode}
504\usetikzlibrary{positioning,arrows, calc, babel}
505
506\newif\if@external\@externaltrue
507\DeclareOption{noexternal}{
508 \@externalfalse
509}
510\def\apunts@folder{figures/}
511
512\pgfplotsset{compat=1.11}
513% \end{macrocode}
Ernesto Lanchares29b298b2019-10-01 19:41:04 +0200514%
515% Lastly, we procces the options.
516% \begin{macrocode}
oscarbeneditoef77d902019-09-30 19:44:52 +0200517\ProcessOptions\relax
Ernesto Lanchares0641d3d2019-10-01 19:39:23 +0200518
519\if@external
520 \usetikzlibrary{external}
521 \tikzexternalize[prefix=\apunts@folder]
522\fi
523
oscarbeneditoef77d902019-09-30 19:44:52 +0200524\if@babel
525 \PassOptionsToPackage{\@babelopt}{babel}
526 \RequirePackage{babel}
527\fi
528\ifnum\@babellang=1
529 % Normal
530 \declaretheorem[style=normal,name=Lema,numberwithin=section]{lema}
531 \declaretheorem[style=normal,name=Lema,numbered=no]{lema*}
532 \declaretheorem[style=normal,name=Observació,sibling=lema]{obs}
533 \declaretheorem[style=normal,name=Observació,numbered=no]{obs*}
534 \declaretheorem[style=normal,name=Proposició,sibling=lema]{prop}
535 \declaretheorem[style=normal,name=Proposició,numbered=no]{prop*}
536 \declaretheorem[style=normal,name=Definició,sibling=lema]{defi*}
537 \declaretheorem[style=normal,name=Coro{\lgem}ari,sibling=lema]{col}
538 \declaretheorem[style=normal,name=Coro{\lgem}ari,numbered=no]{col*}
539 \declaretheorem[style=normal,name=Exercici,sibling=lema]{ej}
540 \declaretheorem[style=normal,name=Exercici,numbered=no]{ej*}
541 \declaretheorem[style=normal,name=Exemple,sibling=lema]{example}
542 \declaretheorem[style=normal,name=Exemple,numbered=no]{example*}
543 \declaretheorem[style=normal,name=Problema,sibling=lema]{problema}
544 \declaretheorem[style=normal,name=Problema,numbered=no]{problema*}
545
546 % Autodefi
547 \declaretheorem[style=autodefi,name=Definició,sibling=lema]{defi}
548
549 % Demo
550 \let\proof\relax
551 \declaretheorem[style=demo,name=Demostració,qed=$\square$,numbered=no]{proof}
552 \declaretheorem[style=demo,name=Solució,numbered=no]{sol}
553
554 % Break
555 \declaretheorem[style=break,name=Teorema,sibling=lema]{teo*}
556
557 % Breakthm
558 \declaretheorem[style=breakthm,name=Teorema,sibling=lema]{teo}
559
560 \@ifclassloaded{book}{%
561 \AtBeginDocument{\renewcommand{\chaptername}{Tema}}
562 }{}
563\fi
564\ifnum\@babellang=2
oscarbenedito6bc418b2019-09-20 13:28:57 +0200565 % Normal
566 \declaretheorem[style=normal,name=Lema,numberwithin=section]{lema}
567 \declaretheorem[style=normal,name=Lema,numbered=no]{lema*}
568 \declaretheorem[style=normal,name=Observación,sibling=lema]{obs}
569 \declaretheorem[style=normal,name=Observación,numbered=no]{obs*}
570 \declaretheorem[style=normal,name=Proposición,sibling=lema]{prop}
571 \declaretheorem[style=normal,name=Proposición,numbered=no]{prop*}
572 \declaretheorem[style=normal,name=Definición,sibling=lema]{defi*}
573 \declaretheorem[style=normal,name=Corolario,sibling=lema]{col}
574 \declaretheorem[style=normal,name=Corolario,numbered=no]{col*}
575 \declaretheorem[style=normal,name=Ejercicio,sibling=lema]{ej}
576 \declaretheorem[style=normal,name=Ejercicio,numbered=no]{ej*}
577 \declaretheorem[style=normal,name=Ejemplo,sibling=lema]{example}
578 \declaretheorem[style=normal,name=Ejemplo,numbered=no]{example*}
579 \declaretheorem[style=normal,name=Problema,sibling=lema]{problema}
580 \declaretheorem[style=normal,name=Problema,numbered=no]{problema*}
581
582 % Autodefi
583 \declaretheorem[style=autodefi,name=Definición,sibling=lema]{defi}
584
585 % Demo
586 \let\proof\relax
587 \declaretheorem[style=demo,name=Demostración,qed=$\square$,numbered=no]{proof}
588 \declaretheorem[style=demo,name=Solución,numbered=no]{sol}
589
590 % Break
591 \declaretheorem[style=break,name=Teorema,sibling=lema]{teo*}
592
593 % Breakthm
594 \declaretheorem[style=breakthm,name=Teorema,sibling=lema]{teo}
oscarbeneditoef77d902019-09-30 19:44:52 +0200595
oscarbenedito6bc418b2019-09-20 13:28:57 +0200596 \@ifclassloaded{book}{%
597 \AtBeginDocument{\renewcommand{\contentsname}{Contenidos}}
598 \AtBeginDocument{\renewcommand{\chaptername}{Tema}}
599 }{}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200600\fi
601% \end{macrocode}
602%
603% \iffalse
604%</package>
605% \fi
606% \section{Class implementation}
607% \iffalse
608%<*class>
609% \fi
610% \subsection{Imports}
611% \begin{macrocode}
612\RequirePackage[utf8]{inputenc}
613\RequirePackage[T1]{fontenc}
oscarbeneditoef77d902019-09-30 19:44:52 +0200614\RequirePackage{lmodern}
MiquelOrtega9872c512020-04-22 00:40:41 +0200615\RequirePackage{graphicx}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200616% \end{macrocode}
617%
618% \subsection{Language}
619% The default language is english
620% \begin{macrocode}
621\newcommand*{\@authortext}{Author}
622\newcommand*{\@authorstext}{Authors}
oscarbeneditoef77d902019-09-30 19:44:52 +0200623\newcommand*{\@prauthortext}{Principal author}
624\newcommand*{\@prauthorstext}{Principal authors}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200625\newcommand*{\@otherauthortext}{Other authors}
oscarbeneditoef77d902019-09-30 19:44:52 +0200626\newcommand*{\@reviewertext}{Reviewers}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200627\newcommand*{\@lastupdatetext}{Last update}
Ferran López17453ef2020-09-10 14:53:05 +0200628\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}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200629\newcommand*{\titlemonth}[1]{\gdef\@titlemonth{#1}}
630
631\DeclareOption{spanish}{
632 \renewcommand*{\languagename}{spanish}
oscarbeneditoef77d902019-09-30 19:44:52 +0200633 \renewcommand*{\@authortext}{Autor}
634 \renewcommand*{\@authorstext}{Autores}
635 \renewcommand*{\@prauthortext}{Autor principal}
636 \renewcommand*{\@prauthorstext}{Autores principales}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200637 \renewcommand*{\@otherauthortext}{Otros autores}
oscarbeneditoef77d902019-09-30 19:44:52 +0200638 \renewcommand*{\@reviewertext}{Revisores}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200639 \renewcommand*{\@lastupdatetext}{\'Ultima modificaci\'on}
Ferran López17453ef2020-09-10 14:53:05 +0200640 \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 +0200641}
642
MiquelOrtega9872c512020-04-22 00:40:41 +0200643\newif\if@puntvolat\@puntvolatfalse
oscarbenedito6bc418b2019-09-20 13:28:57 +0200644\DeclareOption{catalan}{
645 \renewcommand*{\languagename}{catalan}
oscarbeneditoef77d902019-09-30 19:44:52 +0200646 \renewcommand*{\@authortext}{Autor}
647 \renewcommand*{\@authorstext}{Autors}
648 \renewcommand*{\@prauthortext}{Autor principal}
649 \renewcommand*{\@prauthorstext}{Autors principals}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200650 \renewcommand*{\@otherauthortext}{Altres autors}
oscarbeneditoef77d902019-09-30 19:44:52 +0200651 \renewcommand*{\@reviewertext}{Revisors}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200652 \renewcommand*{\@lastupdatetext}{\'Ultima modificaci\'o}
Ferran López17453ef2020-09-10 14:53:05 +0200653 \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}
MiquelOrtega9872c512020-04-22 00:40:41 +0200654 \@puntvolattrue
oscarbenedito6bc418b2019-09-20 13:28:57 +0200655}
656% \end{macrocode}
657%
658% \subsection{Metatadata}
659% TODO creo que no funciona o algo así...
660% \begin{macrocode}
661\newcommand*{\generatemetadata}{%
662 \renewcommand*{\and}{ and }
663 \hypersetup{
664 pdfauthor={\@author}
665 }
666 \renewcommand*{\and}{ }
667 \hypersetup{
668 pdftitle={{\@title} -- ApuntsFME},
669 pdfsubject={\@title},
670 pdfkeywords={ApuntsFME},
671 }
672}
673% \end{macrocode}
674%
675% \subsection{Process options}
676% \begin{macrocode}
677\ProcessOptions\relax
678% \end{macrocode}
679%
680% \subsection{Import class}
681% Again we don't think making the whole thing from scratch was viable.
682% \begin{macrocode}
683\LoadClass[12pt]{book}
684% \end{macrocode}
685%
686% \subsection{Title page}
687% Here we create the title page, one of the strengths of this class
688%
689% \subsubsection{Last update}
690% \begin{macrocode}
691\newif\if@lastupdate\@lastupdatetrue
692\newcommand*{\nolastupdate}{\@lastupdatefalse}
693% \end{macrocode}
694%
695% \subsubsection{Authors}
696% \begin{macrocode}
697\newcommand*{\@metaauthor}{}
698
oscarbenedito6bc418b2019-09-20 13:28:57 +0200699\newcount\apuntsfme@numberauthor
700\apuntsfme@numberauthor=0
701
702\def\@author{}
703\renewcommand*{\author}[1]{%
704 \expandafter\gdef\csname apuntsfme@author\the\apuntsfme@numberauthor\endcsname{#1}%
705 \advance\apuntsfme@numberauthor by1 %
706}
707% \end{macrocode}
708%
709% \subsubsection{Other Authors}
710% \begin{macrocode}
oscarbeneditoef77d902019-09-30 19:44:52 +0200711\def\@otherauthor{}
712\newcommand*{\otherauthor}[1]{%
713 \ifx\@otherauthor\empty %
714 \gdef\@otherauthor{#1}%
715 \else%
716 \expandafter\gdef\expandafter\@otherauthor\expandafter{\@otherauthor, #1}%
717 \fi%
718}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200719% \end{macrocode}
720%
721% \subsubsection{Reviewers}
722% \begin{macrocode}
oscarbeneditoef77d902019-09-30 19:44:52 +0200723\def\@reviewer{}
724\newcommand*{\reviewer}[1]{%
725 \ifx\@reviewer\empty %
726 \gdef\@reviewer{#1}%
727 \else%
728 \expandafter\gdef\expandafter\@reviewer\expandafter{\@reviewer, #1}%
729 \fi%
730}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200731% \end{macrocode}
732%
733% \subsubsection{Subtitle}
734% \begin{macrocode}
735\newcommand*{\subtitle}[1]{\gdef\@subtitle{#1}}
736\newcommand*{\@subtitle}{}
737% \end{macrocode}
738%
739% \subsubsection{Thanks comment}
740% \begin{macrocode}
741\newcommand*{\thankscomment}[1]{\gdef\@thankscomment{#1}}
742\newcommand*{\@thankscomment}{}
743% \end{macrocode}
744%
745% \subsubsection{Title page}
746% All of the previous sections are combined here were we actually make the title page.
747% TODO remove doclicense
748% \begin{macrocode}
749\renewcommand*{\maketitle}{%
750\generatemetadata
751\begin{titlepage}
oscarbeneditoef77d902019-09-30 19:44:52 +0200752 \centering\scshape%
753 \vspace*{\fill}%
754 \rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt} %
755 \rule{\textwidth}{0.4pt} %
756
oscarbenedito6bc418b2019-09-20 13:28:57 +0200757 \vspace{0.75\baselineskip}
oscarbeneditoef77d902019-09-30 19:44:52 +0200758
759 \renewcommand*{\and}{\protect\\}%
oscarbenedito6bc418b2019-09-20 13:28:57 +0200760 {\LARGE \expandafter\MakeUppercase\expandafter{\@title}\\}
761
762 \vspace{0.75\baselineskip}
763
oscarbeneditoef77d902019-09-30 19:44:52 +0200764 \rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} %
765 \rule{\textwidth}{1.6pt} %
oscarbenedito6bc418b2019-09-20 13:28:57 +0200766
767 \vspace{1.5\baselineskip}
768
769 \@subtitle
770
771 \vspace*{\fill}
772 \vspace*{\fill}
773 \vspace*{\fill}
774 \vspace*{\fill}
775 \vspace*{\fill}
776 \vspace*{\fill}
777
778 \includegraphics[width=5cm]{../logo.pdf}
779
780 \vspace{0.3\baselineskip}
781
782 Barcelona, \@titlemonth
783\end{titlepage}
784
785\vspace*{\fill}
786
oscarbeneditoef77d902019-09-30 19:44:52 +0200787\ifnum\apuntsfme@numberauthor=0%
788\else%
789 \ifx\@otherauthor\empty %
790 \ifnum\apuntsfme@numberauthor=1%
791 \noindent \@authortext: %
792 \else%
793 \noindent \@authorstext: %
794 \fi%
795 \else%
796 \ifnum\apuntsfme@numberauthor=1%
797 \noindent \@prauthortext: %
798 \else%
799 \noindent \@prauthorstext: %
800 \fi%
801 \fi
802 \newcount\apuntsfme@tempauthor%
803 \loop%
804 \ifnum\apuntsfme@tempauthor=0 %
805 \else%
806 , %
807 \fi%
808 \csname apuntsfme@author\the\apuntsfme@tempauthor\endcsname%
809 \advance\apuntsfme@tempauthor by 1 %
810 \ifnum\apuntsfme@tempauthor < \apuntsfme@numberauthor%
811 \repeat%
812 .%
oscarbenedito6bc418b2019-09-20 13:28:57 +0200813\fi
814\ifx\@otherauthor\empty
815\else
816
817 \quad
818
819 \noindent \@otherauthortext: \@otherauthor.
820\fi
821\ifx\@reviewer\empty
822\else
823
824 \quad
825
oscarbenedito6bc418b2019-09-20 13:28:57 +0200826 \noindent \@reviewertext: \@reviewer.
827\fi
828\ifx\@thankscomment\empty
829\else
830
831 \quad
832
833 \noindent \@thankscomment
834\fi
835\if@lastupdate
836
837 \quad
838
839 \noindent \@lastupdatetext: \@date.
840\fi
841
842\doclicenseThis
843}
844% \end{macrocode}
845%
846% \subsection{Other commands}
847%
848% \begin{macro}{\makecover}
849% \begin{macrocode}
850\newcommand*{\makecover}{
851 \frontmatter
852 \maketitle
853 \tableofcontents
854 \mainmatter
855}
856% \end{macrocode}
857% \end{macro}
858%
859% \subsection{Other includes}
MiquelOrtega9872c512020-04-22 00:40:41 +0200860% These packages need to be included last, so we place them here. The hyperref
861% package is included as late as possible. TODO remove doclicense
oscarbenedito6bc418b2019-09-20 13:28:57 +0200862% \begin{macrocode}
863\RequirePackage[a4paper,margin=1in]{geometry}
MiquelOrtega9872c512020-04-22 00:40:41 +0200864\AtBeginDocument{\RequirePackage{hyperref}}
oscarbenedito6bc418b2019-09-20 13:28:57 +0200865\RequirePackage[
866 type={CC},
867 modifier={by-nc-sa},
868 version={4.0},
869]{doclicense}
870% \end{macrocode}
871%
flopguic1a33f52020-02-11 19:16:46 +0100872% \subsection{Parche punt volat}
873
874%Definició de la ela geminada per tal que accepti el punt volat del teclat
MiquelOrtega559b67d2020-07-20 19:03:28 +0200875% \begin{macrocode}
MiquelOrtega9872c512020-04-22 00:40:41 +0200876\if@puntvolat
877 \def·#1{%
878 \ifmmode
879 \cdot #1
flopguic1a33f52020-02-11 19:16:46 +0100880 %\csname normal@char\string"\endcsname l%
MiquelOrtega9872c512020-04-22 00:40:41 +0200881 \else%
882 \def\argument{#1}%
883 \if\argument l%
884 \leftllkern=0pt\rightllkern=0pt\raiselldim=0pt%
885 \setbox0\hbox{l}\setbox1\hbox{l\/}\setbox2\hbox{.}%
886 \advance\raiselldim by \the\fontdimen5\the\font
887 \advance\raiselldim by -\ht2%
888 \leftllkern=-.5\wd0%
889 \advance\leftllkern by \wd1%
890 \advance\leftllkern by -\wd0%
891 \rightllkern=-.5\wd0%
892 \advance\rightllkern by -\wd1%
893 \advance\rightllkern by \wd0%
894 \allowhyphens\discretionary{-}{l}%
895 {\hbox{}\kern\leftllkern\raise\raiselldim\hbox{.}%
896 \kern\rightllkern\hbox{l}}\allowhyphens%
897 \else
898 \if\argument L%
899 \leftllkern=0pt\rightllkern=0pt\raiselldim=0pt%
900 \setbox0\hbox{L}\setbox1\hbox{L\/}\setbox2\hbox{.}%
901 \advance\raiselldim by .5\ht0%
902 \advance\raiselldim by -.5\ht2%
903 \leftllkern=-.5\wd0%
904 \advance\leftllkern by \wd1%
905 \advance\leftllkern by -\wd0%
906 \rightllkern=.375\wd0%
907 \divide\rightllkern by 6%
908 \advance\rightllkern by -\wd1%
909 \advance\rightllkern by \wd0%
910 \allowhyphens\discretionary{-}{L}%
911 {\hbox{}\kern\leftllkern\raise\raiselldim\hbox{.}%
912 \kern\rightllkern\hbox{L}}\allowhyphens%
913 \else
914 #1
915 \fi
916 \fi
917 \fi
918 }
919\fi
MiquelOrtega559b67d2020-07-20 19:03:28 +0200920% \end{macrocode}
flopguic1a33f52020-02-11 19:16:46 +0100921
oscarbenedito6bc418b2019-09-20 13:28:57 +0200922% \iffalse
923%</class>
924% \fi