blob: 6682409ee982c33d38423bc157241567f5c7c60f [file] [log] [blame]
% \iffalse meta-comment
%
%% apuntsfme.dtx
%% Copyright 2019 ApuntsFME
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is the ApuntsFME organization.
%
% This work consists of the files apuntsfme.dtx and apuntsfme.ins
% and the derived file apuntsfme.sty.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{apuntsfme.dtx}
%</driver>
%
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{apuntsfme}[2019/07/08 v1.o .dtx apuntsfme file]
%
%<class>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<class>\ProvidesClass{notes}[2019/10/12 v1.0 class for taking notes in class]
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{apuntsfme}
\usepackage{hyperref}
\usepackage{csquotes}
\usepackage{booktabs}
\usepackage{longtable}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
\DocInput{apuntsfme.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
% {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
% 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
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \<
% Equals \= Greater than \> Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
% \changes{v1.0}{2019/07/14}{Initial version}
%
% \GetFileInfo{apuntsfme.sty}
%
%
% \title{The \textsf{ApuntsFME} package\thanks{This document
% corresponds to \textsf{apuntsfme}~\fileversion,
% dated~\filedate.}}
% \author{Ernesto Lanchares\\ \href{mailto:e.lancha98@gmail.com}{e.lancha98@gmail.com} \and Oscar Benedito \\ \href{mailto:oscar@oscarbenedito.com}{oscar@oscarbenedito.com}}
%
% \maketitle
%
% \begin{abstract}
% A package that aims to make taking notes in math class in \LaTeX\ easy.
% \end{abstract}
%
% The goal of this package is make taking notes on class easy. It includes a lot of packages and shortcuts
% that aim to make it easy to remember and easy to type. Note that this package is not meant to set a
% reference in how \LaTeX\ should be writter nor it's meant to be a guideline of any kind.
%
% \section{The ApuntsFME package}
% The ApuntsFME package has the purpose of providing the shortcuts and
% environments used for short typing.
%
% \subsection{Packages imported}
% As mentioned, this package collects a lot of other packages all very common to math typing. Here's a
% table with all of them and the use that they provide.
%
% \begin{longtable}{p{.2\textwidth}p{.6\textwidth}}
% Package & Usage \\ \toprule \toprule
% \endhead
% \bottomrule \multicolumn{2}{c}{{Continued on next page}} \\
% \endfoot
% \bottomrule
% \endlastfoot
% inputenc & loaded with the \texttt{utf-8} option, used so the characters
% are interpreted as unicode text \\ \midrule
% fontenc & loaded with the \texttt{T1} option. It's used so, in the output
% PDF, you can search for accented words \\ \midrule
% lmodern & To have the fonts have high quality \\ \midrule
% hyperref & To have clickable links and urls \\ \midrule
% enumitem & loaded with \texttt{shortlabels}. Used to control enumerates \\
% \midrule
% amsmath & The American Mathematical Society \LaTeX\ package. Loads common
% math utilities \\ \midrule
% amsthm & The American Mathematical Society package used to typeset
% theorems, propositions, \dots \\ \midrule
% amssymb & The American Mathematical Society pacakgae that defines a lot of
% ``common'' symbols \\ \midrule
% graphicx & A lot of support for graphics inside the document \\ \midrule
% mathtools & A set of mathematical tools. \\ \midrule
% tikz & A package to create graphics inside \LaTeX. \\ \midrule
% makeidx & This is what creates the glossary with the definitions. \\
% \midrule
% cancel & This package allows to cancel things in equations by marking them
% with a line (just as you would do in a paper) \\ \midrule
% pgf & Is the backend of \texttt{pgfplots} \\ \midrule
% pgfplots & This is used with \texttt{tikz} to make axis plots \\ \midrule
% mathrsfs & Support for using RSFS fonts in maths \\ \midrule
% thmtools & This is used to furder customize the \texttt{amsthm}
% environments \\ \midrule
% tikz-cd & An extension of \texttt{tikz} to create commutative diagrams \\
% \midrule
% faktor & Used to typeset quotient structures \\ \midrule
% physics & More macros for maths \\ \midrule
% float & Let's you controll the figures position \\ \midrule
% \end{longtable}
%
% It's interesting to note that we load TiKz and PGF because we bet for making
% the figures inside \LaTeX\ and not with another external tool. However, this
% has a drawback and is that it reduces compilation times by quite a lot. To
% mitigate that effect we also use \texttt{external} with TiKz. This library,
% makes the first computation very very slow and creates a directory with all
% the figures generated from the code. Then, the rest of the compilations just
% need to import that precomputed figure so they are a lot faster. This
% behaviour can be turned off by the \texttt{noexternal} option.
%
% You also can controll the output folder of these figures with the option
% \texttt{externalfolder}. Here's an example in how to put the figures in the
% folder myfigures. But remember that this option will be ignored if you use
% \texttt{noexternal}.
%
% \begin{verbatim}
% \usepackage[externalfolder=myfigures]{apuntsfme}
% \end{verbatim}
%
% \StopEventually{}
%
% \section{Package implementation}
% \iffalse
%<*package>
% \fi
% \subsection{Includes}
%
% In the first place, we need to import some other packages (in fact, a lot of them). We
% considered that there's no need in reinventing the wheel so our work is based on this packages
%
% \begin{macrocode}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
\RequirePackage[shortlabels]{enumitem}
\RequirePackage{amsmath,amsthm,amssymb,graphicx,mathtools,tikz,makeidx}
\RequirePackage{cancel,pgf,pgfplots,mathrsfs,thmtools,tikz-cd,faktor}
\RequirePackage{physics,float}
% \end{macrocode}
%
% Then we have lots of packages that we want to remove but have some documents that use them
% so we don't remove them because laziness.
% \begin{macrocode}
\RequirePackage{xfrac} % Fa els sfrac, per cert un a multi esta malamanet??
\RequirePackage{siunitx} %Crec que cal canviar codi
\RequirePackage{centernot} % Aixo es exclusiu d'estructures per fer un \not concret als mid?
\RequirePackage{multicol} % Exclusiu dels formularis?
\RequirePackage{xcolor} % Aixo potser es d'un document concret
\RequirePackage{needspace} %No se si es gaire util, compila sense incloure'l
\RequirePackage{commath} % Aquest implement els \dif, cal canviar tot el codi per ferho amb physics
\RequirePackage{dsfont} % No se que fa, compila si el trec
\RequirePackage{mdframed,stackengine,stmaryrd,multirow}
\RequirePackage{hyperref, cleveref}
% \end{macrocode}
%
%
% And some style definitions, just because we can.
% \begin{macrocode}
\let\emptyset\varnothing
\setcounter{secnumdepth}{4}
\def\mydate{\today}
\hypersetup{
colorlinks,
linkcolor=blue
}
% \end{macrocode}
%
% \subsection{Useful commands}
% In this section we provide some useful commands.
%
% We start with some commands that need to be removed but again, laziness
% \begin{macrocode}
%\newcommand{\ap}[1]{\ensuremath\overline{#1}}
%\newcommand{\Sup}[1]{\ensuremath\underset{#1}{\sup}}
%\newcommand{\Max}[1]{\ensuremath\underset{#1}{\max}}
%\newcommand{\Min}[1]{\ensuremath\underset{#1}{\min}}
%\newcommand{\scin}[1]{\ensuremath\SI{#1}{}}
\newcommand\comp[1]{\overline{#1}} % Treure? #SouUnsVagos
\newcommand\inv[1]{#1^{-1}} % Habra que sacarlo de algun documento?
\newcommand{\ita}[1]{\textit{#1}} % Habra que sacarlo de algun documento?
\newmdenv[leftline=false,topline=false]{topright}
% \end{macrocode}
%
% Now we can proceed into the part that we are proud of. First some commands
% \begin{macrocode}
%\newcommand\mapsfrom{\mathrel{\reflectbox{\ensuremath{\mapsto}}}} %Already defined?
\newcommand*{\bimplies}{\boxed{\implies}}
\newcommand*{\bimpliedby}{\boxed{\impliedby}}
% \end{macrocode}
%
% \subsubsection{Mathbb commands}
% Again, with some parts that needs removing/refactoring
% \begin{macrocode}
\newcommand{\n}{\mathbb{N}}
\newcommand{\z}{\mathbb{Z}}
\newcommand{\q}{\mathbb{Q}}
\newcommand{\cx}{\mathbb{C}}
\renewcommand{\real}{\mathbb{R}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\F}{\mathbb{F}}
\newcommand{\A}{\mathbb{A}}
\newcommand{\bb}[1]{\mathbb{#1}}
\newcommand{\Po}{\mathbb{P}}
\newcommand{\esp}{\mathbb{E}}
\DeclareMathOperator{\cov}{\mathbb{C}ov} % TODO esto que?
\let\var\relax
\DeclareMathOperator{\var}{\mathbb{V}ar} % TODO esto que?
% \end{macrocode}
%
% \subsubsection{Mathcal commands}
%
% \begin{macrocode}
\newcommand{\R}{\mathcal{R}}
\newcommand{\Pa}{\mathcal{P}}
\newcommand{\Es}{\mathcal{E}}
\newcommand{\V}{\mathcal{V}}
\newcommand{\T}{\mathcal{T}}
\newcommand{\B}{\mathcal{B}}
\let\O\relax
\newcommand{\O}{\mathcal{O}}
\newcommand{\Sim}{\mathcal{S}}
\newcommand{\Asim}{\mathcal{A}} % TODO aquest i el dabaix son el mateix
\newcommand{\Asuc}{\mathcal{A}} % Conjunt de successos
\newcommand{\matspace}{\mathcal{M}} %Espai de matrius
% \end{macrocode}
%
% \subsubsection{Mathscr and others}
% \begin{macrocode}
\newcommand{\C}{\mathscr{C}}
\let\k\relax
\newcommand{\k}{\Bbbk}
% \end{macrocode}
%
% \subsubsection{Math utilities}
% \begin{macrocode}
\newcommand{\trir}{\triangleright}
\newcommand{\tril}{\triangleleft}
\newcommand{\limvar}[2]{\lim\limits_{#1 \rightarrow #2}} % Para escribir limites más rapido
\newcommand{\notimplies}{\mathrel{{\ooalign{\hidewidth$\not\phantom{=}$%
\hidewidth\cr$\implies$}}}}
\newcommand{\defeq}{\stackrel{\text{\tiny def}}{=}} % Símbol 'definit com'
\def\upint{\mathchoice%
{\mkern13mu\overline{\vphantom{\intop}\mkern7mu}\mkern-20mu}%
{\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
{\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
{\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
\int}
\def\lowint{\mkern3mu\underline{\vphantom{\intop}\mkern7mu}\mkern-10mu\int}
% \end{macrocode}
%
% \subsubsection{Left-right thing}
% For good practice this ones should be removed but hey using an IDE with macro insertion
% is aparently very difficult...
% \begin{macrocode}
\newcommand\setb[1]{\left\{#1\right\}} % Deberia irse?
\newcommand{\vbrack}[1]{\langle #1\rangle}
\newcommand{\spr}[1]{\langle #1 \rangle} % TODO aquest i lanterior son el mateix
\newcommand{\lp}{\left(}
\newcommand{\rp}{\right)}
\newcommand{\lc}{\left\{}
\newcommand{\rc}{\right\}}
\newcommand{\lb}{\left[}
\newcommand{\rb}{\right]}
% \end{macrocode}
%
% \subsubsection{Math operators}
% \begin{macrocode}
\DeclareMathOperator{\Ec}{Ec}
\DeclareMathOperator{\Ep}{Ep}
\DeclareMathOperator{\orden}{o}
\DeclareMathOperator{\ord}{ord}
\DeclareMathOperator{\card}{card}
\DeclareMathOperator{\mcm}{mcm}
\DeclareMathOperator{\mcd}{mcd}
\DeclareMathOperator{\lcm}{lcm}
\DeclareMathOperator{\Em}{Em}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator{\fr}{Fr}
\DeclareMathOperator{\Id}{Id}
\DeclareMathOperator{\ext}{Ext}
\DeclareMathOperator{\inte}{Int}
\DeclareMathOperator{\rie}{Rie}
\DeclareMathOperator{\rg}{rg}
\DeclareMathOperator{\gr}{gr}
\DeclareMathOperator{\nuc}{Nuc}
\DeclareMathOperator{\car}{car}
\DeclareMathOperator{\im}{Im}
\DeclareMathOperator{\re}{Re}
\DeclareMathOperator{\spec}{Spec}
\DeclareMathOperator{\Log}{Log}
\DeclareMathOperator{\Arg}{Arg}
%\DeclareMathOperator{\tr}{tr} % Already in physics
\DeclareMathOperator{\vol}{vol}
%\DeclareMathOperator{\grad}{grad} % Already in physics
\DeclareMathOperator{\rot}{rot}
\DeclareMathOperator{\diver}{div}
\DeclareMathOperator{\sinc}{sinc}
\DeclareMathOperator{\graf}{graf}
\DeclareMathOperator{\TQ}{\text{ tal que }}
\DeclareMathOperator{\tq}{\;t.q.\;}
\DeclareMathOperator{\disc}{disc}
\DeclareMathOperator{\fl}{fl} % Representación en coma flotante
\DeclareMathOperator{\sgn}{sgn} % Función signo (sgn) de una permutación
\DeclareMathOperator{\diag}{diag} % Notación corta para matriz diagonal: diag(d_1,...,d_n)
\DeclareMathOperator{\vspan}{span}
% \end{macrocode}
%
% \subsubsection{Index}
% \begin{macrocode}
\newcounter{apuntsfme@index}
\setcounter{apuntsfme@index}{1}
\def\consume#1{}%
\def\printcmd{\expandafter\consume\string}
\def\idx#1{%
\edef\apuntsfme@tmp{apuntsfme@index:\Roman{apuntsfme@index}}%
\expandafter\label\expandafter{\apuntsfme@tmp}%
\expandafter\xdef\csname indice\Roman{apuntsfme@index}\endcsname%
##1{\noexpand\hyperref[apuntsfme@index:\Roman{apuntsfme@index}]{##1}}%
\index{#1|\expandafter\printcmd\csname indice\Roman{apuntsfme@index}\endcsname}%
\stepcounter{apuntsfme@index}%
}
\makeindex
\RequirePackage[totoc]{idxlayout} % Glossari a l'índex
% \end{macrocode}
%
% \subsection{Environments}
% Here we define the environments in which the notes we take are based on.
%
% TODO add an option to the package to select the position of the number (before/after)
% \begin{macrocode}
\newtheoremstyle{break}% name
{}% Space above, empty = `usual value'
{}% Space below
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{}% Punctuation after thm head
{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}\newline}}% Thm head spec
\newtheoremstyle{demo}% name
{}% Space above, empty = `usual value'
{}% Space below
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\it}% Thm head font
{}% Punctuation after thm head
{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
{#1\thmnote{ #3}.}% Thm head spec
\newtheoremstyle{breakthm}% name
{}% Space above, empty = `usual value'
{}% Space below
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{}% Punctuation after thm head
{\newline}% Space after thm head: \newline = linebreak
{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}}\addcontentsline{toc}{subsection}{#3}}% Thm head spec
\newtheoremstyle{normal}% name
{}% Space above, empty = `usual value'
{}% Space below
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{}% Punctuation after thm head
{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
{\thmname{#1}\thmnumber{ #2}.\thmnote{ {\it #3.}}}% Thm head spec
\newtheoremstyle{autodefi}% name
{}% Space above, empty = `usual value'
{}% Space below
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{}% Punctuation after thm head
{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
{\idx{#3}\thmname{#1}\thmnumber{ #2}.}% Thm head specko
% \end{macrocode}
%
% \subsection{Options}
% Here we have some options for the package
%
% \subsubsection{Babel}
% TODO add english support and make it the default
% \begin{macrocode}
\DeclareOption{numbersbefore}{
\newtheoremstyle{break}% name
{}% Space above, empty = `usual value'
{}% Space below
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{}% Punctuation after thm head
{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
{\thmnumber{#2}. \thmname{#1.}\thmnote{ {\it #3.}\newline}}% Thm head spec
\newtheoremstyle{demo}% name
{}% Space above, empty = `usual value'
{}% Space below
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\it}% Thm head font
{}% Punctuation after thm head
{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
{#1\thmnote{ #3}.}% Thm head spec
\newtheoremstyle{breakthm}% name
{}% Space above, empty = `usual value'
{}% Space below
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{}% Punctuation after thm head
{\newline}% Space after thm head: \newline = linebreak
{\thmnumber{#2}. \thmname{#1.}\thmnote{ {\it #3.}}\addcontentsline{toc}{subsection}{#3}}% Thm head spec
\newtheoremstyle{normal}% name
{}% Space above, empty = `usual value'
{}% Space below
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{}% Punctuation after thm head
{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
{\thmnumber{#2}. \thmname{#1.}\thmnote{ {\it #3.}}}% Thm head spec
\newtheoremstyle{autodefi}% name
{}% Space above, empty = `usual value'
{}% Space below
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{}% Punctuation after thm head
{5pt plus 1pt minus 1pt}% Space after thm head: \newline = linebreak
{\idx{#3}\label{defi:#2}\thmnumber{#2}. \thmname{#1.}}% Thm head specko
}
\newif\if@babel\@babeltrue
\newcount\@babellang
\@babellang=0
\def\@babelopt{english}
\DeclareOption{nobabel}{
\@babelfalse
}
\DeclareOption{catalan}{
\gdef\@babelopt{catalan}
\@babellang=1
}
\DeclareOption{spanish}{
\gdef\@babelopt{spanish,es-lcroman,es-nolists}
\@babellang=2
}
% \end{macrocode}
%
% Then, we need to configure TiKz and PGF
% \begin{macrocode}
\usetikzlibrary{positioning,arrows, calc, babel}
\newif\if@external\@externaltrue
\DeclareOption{noexternal}{
\@externalfalse
}
\def\apunts@folder{figures/}
\pgfplotsset{compat=1.11}
% \end{macrocode}
%
% Lastly, we procces the options.
% \begin{macrocode}
\ProcessOptions\relax
\if@external
\usetikzlibrary{external}
\tikzexternalize[prefix=\apunts@folder]
\fi
\if@babel
\PassOptionsToPackage{\@babelopt}{babel}
\RequirePackage{babel}
\fi
\ifnum\@babellang=1
% Normal
\declaretheorem[style=normal,name=Lema,numberwithin=section]{lema}
\declaretheorem[style=normal,name=Lema,numbered=no]{lema*}
\declaretheorem[style=normal,name=Observació,sibling=lema]{obs}
\declaretheorem[style=normal,name=Observació,numbered=no]{obs*}
\declaretheorem[style=normal,name=Proposició,sibling=lema]{prop}
\declaretheorem[style=normal,name=Proposició,numbered=no]{prop*}
\declaretheorem[style=normal,name=Definició,sibling=lema]{defi*}
\declaretheorem[style=normal,name=Coro{\lgem}ari,sibling=lema]{col}
\declaretheorem[style=normal,name=Coro{\lgem}ari,numbered=no]{col*}
\declaretheorem[style=normal,name=Exercici,sibling=lema]{ej}
\declaretheorem[style=normal,name=Exercici,numbered=no]{ej*}
\declaretheorem[style=normal,name=Exemple,sibling=lema]{example}
\declaretheorem[style=normal,name=Exemple,numbered=no]{example*}
\declaretheorem[style=normal,name=Problema,sibling=lema]{problema}
\declaretheorem[style=normal,name=Problema,numbered=no]{problema*}
% Autodefi
\declaretheorem[style=autodefi,name=Definició,sibling=lema]{defi}
% Demo
\let\proof\relax
\declaretheorem[style=demo,name=Demostració,qed=$\square$,numbered=no]{proof}
\declaretheorem[style=demo,name=Solució,numbered=no]{sol}
% Break
\declaretheorem[style=break,name=Teorema,sibling=lema]{teo*}
% Breakthm
\declaretheorem[style=breakthm,name=Teorema,sibling=lema]{teo}
\@ifclassloaded{book}{%
\AtBeginDocument{\renewcommand{\chaptername}{Tema}}
}{}
\fi
\ifnum\@babellang=2
% Normal
\declaretheorem[style=normal,name=Lema,numberwithin=section]{lema}
\declaretheorem[style=normal,name=Lema,numbered=no]{lema*}
\declaretheorem[style=normal,name=Observación,sibling=lema]{obs}
\declaretheorem[style=normal,name=Observación,numbered=no]{obs*}
\declaretheorem[style=normal,name=Proposición,sibling=lema]{prop}
\declaretheorem[style=normal,name=Proposición,numbered=no]{prop*}
\declaretheorem[style=normal,name=Definición,sibling=lema]{defi*}
\declaretheorem[style=normal,name=Corolario,sibling=lema]{col}
\declaretheorem[style=normal,name=Corolario,numbered=no]{col*}
\declaretheorem[style=normal,name=Ejercicio,sibling=lema]{ej}
\declaretheorem[style=normal,name=Ejercicio,numbered=no]{ej*}
\declaretheorem[style=normal,name=Ejemplo,sibling=lema]{example}
\declaretheorem[style=normal,name=Ejemplo,numbered=no]{example*}
\declaretheorem[style=normal,name=Problema,sibling=lema]{problema}
\declaretheorem[style=normal,name=Problema,numbered=no]{problema*}
% Autodefi
\declaretheorem[style=autodefi,name=Definición,sibling=lema]{defi}
% Demo
\let\proof\relax
\declaretheorem[style=demo,name=Demostración,qed=$\square$,numbered=no]{proof}
\declaretheorem[style=demo,name=Solución,numbered=no]{sol}
% Break
\declaretheorem[style=break,name=Teorema,sibling=lema]{teo*}
% Breakthm
\declaretheorem[style=breakthm,name=Teorema,sibling=lema]{teo}
\@ifclassloaded{book}{%
\AtBeginDocument{\renewcommand{\contentsname}{Contenidos}}
\AtBeginDocument{\renewcommand{\chaptername}{Tema}}
}{}
\fi
% \end{macrocode}
%
% \iffalse
%</package>
% \fi
% \section{Class implementation}
% \iffalse
%<*class>
% \fi
% \subsection{Imports}
% \begin{macrocode}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
\RequirePackage{graphicx}
% \end{macrocode}
%
% \subsection{Language}
% The default language is english
% \begin{macrocode}
\newcommand*{\@authortext}{Author}
\newcommand*{\@authorstext}{Authors}
\newcommand*{\@prauthortext}{Principal author}
\newcommand*{\@prauthorstext}{Principal authors}
\newcommand*{\@otherauthortext}{Other authors}
\newcommand*{\@reviewertext}{Reviewers}
\newcommand*{\@lastupdatetext}{Last update}
\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}
\newcommand*{\titlemonth}[1]{\gdef\@titlemonth{#1}}
\DeclareOption{spanish}{
\renewcommand*{\languagename}{spanish}
\renewcommand*{\@authortext}{Autor}
\renewcommand*{\@authorstext}{Autores}
\renewcommand*{\@prauthortext}{Autor principal}
\renewcommand*{\@prauthorstext}{Autores principales}
\renewcommand*{\@otherauthortext}{Otros autores}
\renewcommand*{\@reviewertext}{Revisores}
\renewcommand*{\@lastupdatetext}{\'Ultima modificaci\'on}
\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}
}
\newif\if@puntvolat\@puntvolatfalse
\DeclareOption{catalan}{
\renewcommand*{\languagename}{catalan}
\renewcommand*{\@authortext}{Autor}
\renewcommand*{\@authorstext}{Autors}
\renewcommand*{\@prauthortext}{Autor principal}
\renewcommand*{\@prauthorstext}{Autors principals}
\renewcommand*{\@otherauthortext}{Altres autors}
\renewcommand*{\@reviewertext}{Revisors}
\renewcommand*{\@lastupdatetext}{\'Ultima modificaci\'o}
\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}
\@puntvolattrue
}
% \end{macrocode}
%
% \subsection{Metatadata}
% TODO creo que no funciona o algo así...
% \begin{macrocode}
\newcommand*{\generatemetadata}{%
\renewcommand*{\and}{ and }
\hypersetup{
pdfauthor={\@author}
}
\renewcommand*{\and}{ }
\hypersetup{
pdftitle={{\@title} -- ApuntsFME},
pdfsubject={\@title},
pdfkeywords={ApuntsFME},
}
}
% \end{macrocode}
%
% \subsection{Process options}
% \begin{macrocode}
\ProcessOptions\relax
% \end{macrocode}
%
% \subsection{Import class}
% Again we don't think making the whole thing from scratch was viable.
% \begin{macrocode}
\LoadClass[12pt]{book}
% \end{macrocode}
%
% \subsection{Title page}
% Here we create the title page, one of the strengths of this class
%
% \subsubsection{Last update}
% \begin{macrocode}
\newif\if@lastupdate\@lastupdatetrue
\newcommand*{\nolastupdate}{\@lastupdatefalse}
% \end{macrocode}
%
% \subsubsection{Authors}
% \begin{macrocode}
\newcommand*{\@metaauthor}{}
\newcount\apuntsfme@numberauthor
\apuntsfme@numberauthor=0
\def\@author{}
\renewcommand*{\author}[1]{%
\expandafter\gdef\csname apuntsfme@author\the\apuntsfme@numberauthor\endcsname{#1}%
\advance\apuntsfme@numberauthor by1 %
}
% \end{macrocode}
%
% \subsubsection{Other Authors}
% \begin{macrocode}
\def\@otherauthor{}
\newcommand*{\otherauthor}[1]{%
\ifx\@otherauthor\empty %
\gdef\@otherauthor{#1}%
\else%
\expandafter\gdef\expandafter\@otherauthor\expandafter{\@otherauthor, #1}%
\fi%
}
% \end{macrocode}
%
% \subsubsection{Reviewers}
% \begin{macrocode}
\def\@reviewer{}
\newcommand*{\reviewer}[1]{%
\ifx\@reviewer\empty %
\gdef\@reviewer{#1}%
\else%
\expandafter\gdef\expandafter\@reviewer\expandafter{\@reviewer, #1}%
\fi%
}
% \end{macrocode}
%
% \subsubsection{Subtitle}
% \begin{macrocode}
\newcommand*{\subtitle}[1]{\gdef\@subtitle{#1}}
\newcommand*{\@subtitle}{}
% \end{macrocode}
%
% \subsubsection{Thanks comment}
% \begin{macrocode}
\newcommand*{\thankscomment}[1]{\gdef\@thankscomment{#1}}
\newcommand*{\@thankscomment}{}
% \end{macrocode}
%
% \subsubsection{Title page}
% All of the previous sections are combined here were we actually make the title page.
% TODO remove doclicense
% \begin{macrocode}
\renewcommand*{\maketitle}{%
\generatemetadata
\begin{titlepage}
\centering\scshape%
\vspace*{\fill}%
\rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt} %
\rule{\textwidth}{0.4pt} %
\vspace{0.75\baselineskip}
\renewcommand*{\and}{\protect\\}%
{\LARGE \expandafter\MakeUppercase\expandafter{\@title}\\}
\vspace{0.75\baselineskip}
\rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} %
\rule{\textwidth}{1.6pt} %
\vspace{1.5\baselineskip}
\@subtitle
\vspace*{\fill}
\vspace*{\fill}
\vspace*{\fill}
\vspace*{\fill}
\vspace*{\fill}
\vspace*{\fill}
\includegraphics[width=5cm]{../logo.pdf}
\vspace{0.3\baselineskip}
Barcelona, \@titlemonth
\end{titlepage}
\vspace*{\fill}
\ifnum\apuntsfme@numberauthor=0%
\else%
\ifx\@otherauthor\empty %
\ifnum\apuntsfme@numberauthor=1%
\noindent \@authortext: %
\else%
\noindent \@authorstext: %
\fi%
\else%
\ifnum\apuntsfme@numberauthor=1%
\noindent \@prauthortext: %
\else%
\noindent \@prauthorstext: %
\fi%
\fi
\newcount\apuntsfme@tempauthor%
\loop%
\ifnum\apuntsfme@tempauthor=0 %
\else%
, %
\fi%
\csname apuntsfme@author\the\apuntsfme@tempauthor\endcsname%
\advance\apuntsfme@tempauthor by 1 %
\ifnum\apuntsfme@tempauthor < \apuntsfme@numberauthor%
\repeat%
.%
\fi
\ifx\@otherauthor\empty
\else
\quad
\noindent \@otherauthortext: \@otherauthor.
\fi
\ifx\@reviewer\empty
\else
\quad
\noindent \@reviewertext: \@reviewer.
\fi
\ifx\@thankscomment\empty
\else
\quad
\noindent \@thankscomment
\fi
\if@lastupdate
\quad
\noindent \@lastupdatetext: \@date.
\fi
\doclicenseThis
}
% \end{macrocode}
%
% \subsection{Other commands}
%
% \begin{macro}{\makecover}
% \begin{macrocode}
\newcommand*{\makecover}{
\frontmatter
\maketitle
\tableofcontents
\mainmatter
}
% \end{macrocode}
% \end{macro}
%
% \subsection{Other includes}
% These packages need to be included last, so we place them here. The hyperref
% package is included as late as possible. TODO remove doclicense
% \begin{macrocode}
\RequirePackage[a4paper,margin=1in]{geometry}
\AtBeginDocument{\RequirePackage{hyperref}}
\RequirePackage[
type={CC},
modifier={by-nc-sa},
version={4.0},
]{doclicense}
% \end{macrocode}
%
% \subsection{Parche punt volat}
%Definició de la ela geminada per tal que accepti el punt volat del teclat
\if@puntvolat
\def·#1{%
\ifmmode
\cdot #1
%\csname normal@char\string"\endcsname l%
\else%
\def\argument{#1}%
\if\argument l%
\leftllkern=0pt\rightllkern=0pt\raiselldim=0pt%
\setbox0\hbox{l}\setbox1\hbox{l\/}\setbox2\hbox{.}%
\advance\raiselldim by \the\fontdimen5\the\font
\advance\raiselldim by -\ht2%
\leftllkern=-.5\wd0%
\advance\leftllkern by \wd1%
\advance\leftllkern by -\wd0%
\rightllkern=-.5\wd0%
\advance\rightllkern by -\wd1%
\advance\rightllkern by \wd0%
\allowhyphens\discretionary{-}{l}%
{\hbox{}\kern\leftllkern\raise\raiselldim\hbox{.}%
\kern\rightllkern\hbox{l}}\allowhyphens%
\else
\if\argument L%
\leftllkern=0pt\rightllkern=0pt\raiselldim=0pt%
\setbox0\hbox{L}\setbox1\hbox{L\/}\setbox2\hbox{.}%
\advance\raiselldim by .5\ht0%
\advance\raiselldim by -.5\ht2%
\leftllkern=-.5\wd0%
\advance\leftllkern by \wd1%
\advance\leftllkern by -\wd0%
\rightllkern=.375\wd0%
\divide\rightllkern by 6%
\advance\rightllkern by -\wd1%
\advance\rightllkern by \wd0%
\allowhyphens\discretionary{-}{L}%
{\hbox{}\kern\leftllkern\raise\raiselldim\hbox{.}%
\kern\rightllkern\hbox{L}}\allowhyphens%
\else
#1
\fi
\fi
\fi
}
\fi
% \iffalse
%</class>
% \fi