|
1 | 1 | % Template: Template Controles LaTeX |
2 | 2 | % Documento: Funciones exclusivas de Template-Controles |
3 | | -% Versión: 1.3.4 (22/04/2018) |
| 3 | +% Versión: 2.0.0 (23/04/2018) |
4 | 4 | % Codificación: UTF-8 |
5 | 5 | % |
6 | 6 | % Autor: Pablo Pizarro R. @ppizarror |
|
11 | 11 | % Sitio web: [http://latex.ppizarror.com/Template-Controles/] |
12 | 12 | % Licencia MIT: [https://opensource.org/licenses/MIT] |
13 | 13 |
|
14 | | -% Insertar nuevo título de pregunta |
15 | | -% #1 Título |
16 | | -\newcommand{\newquestion}[1]{ |
17 | | - \emptyvarerr{\newquestion}{#1}{Titulo pregunta no definido} |
18 | | - \sectionanum{#1} |
19 | | -} |
20 | | - |
21 | | -% Insertar nuevo título de pregunta encerrado en un recuadro |
22 | | -% #1 Número pregunta |
23 | | -\newcommand{\newboxquestion}[1]{ |
24 | | - \emptyvarerr{\newquestion}{#1}{Titulo pregunta no definido} |
25 | | - \phantomsection |
26 | | - \newp \fbox{\ \textbf{#1}.-\ } \noindent |
27 | | - \pdfbookmark[1]{#1}{toc} |
28 | | -} |
29 | | - |
30 | | -% Crea una sección de imágenes múltiples |
31 | | -% #1 Label (opcional) |
32 | | -% #2 Caption |
33 | | -\newenvironment{images}[2][]{ |
34 | | - \def\envimageslabelvar {#1} |
35 | | - \def\envimagescaptionvar {#2} |
36 | | - \def\envimagesinitialized {true} |
37 | | - \vspace{\margintopimages cm} |
38 | | - \captionsetup{margin=\captionmarginmultimg cm} |
39 | | - \begin{figure}[H] \centering |
40 | | - \vspace{-\marginrightmultimage cm} |
41 | | - \vspace{-\marginrightmultimage cm} |
42 | | - \vspace{-\marginrightmultimage cm} |
43 | | - }{ |
44 | | - \setcaptionmargincm{\captionlrmargin} |
45 | | - \ifx\hfuzz\envimagescaptionvar\hfuzz |
46 | | - \vspace{\captionlessmarginimage cm} |
47 | | - \else |
48 | | - \caption{\envimagescaptionvar\envimageslabelvar} |
49 | | - \fi |
50 | | - \end{figure} |
51 | | - \setcaptionmargincm{\captionlrmargin} |
52 | | - \vspace{\marginbottomimages cm} |
53 | | - \def\envimagesinitialized {false} |
54 | | -} |
55 | | -\def\envimagesinitialized {false} |
56 | | - |
57 | | -% Crea una sección de referencias solo para bibtex |
58 | | -\newenvironment{references}{ |
59 | | - \ifthenelse{\equal{\stylecitereferences}{bibtex}}{ |
60 | | - }{ |
61 | | - \throwerror{\references}{Solo se puede usar entorno references con estilo citas \noexpand\stylecitereferences=bibtex} |
62 | | - } |
63 | | - \begingroup |
64 | | - % Se configura las referencias como una sección |
65 | | - \ifthenelse{\equal{\donumrefsection}{true}}{ |
66 | | - \section{\namereferences} |
67 | | - }{ |
68 | | - \sectionanum{\namereferences} |
69 | | - } |
70 | | - \renewcommand{\section}[2]{} |
71 | | - \begin{thebibliography}{99} |
72 | | - } |
73 | | - { |
74 | | - \end{thebibliography} |
75 | | - \endgroup |
76 | | -} |
77 | | - |
78 | | -% Crea una sección de anexos |
79 | | -\newenvironment{anexo}{ |
80 | | - \begingroup |
81 | | - \clearpage |
82 | | - \phantomsection |
83 | | - \ifthenelse{\equal{\showappendixsectitle}{true}}{ |
84 | | - \appendixpage}{ |
85 | | - } |
86 | | - \appendixtitleon |
87 | | - \appendicestocpagenum |
88 | | - \appendixtitletocon |
89 | | - \bookmarksetup{ |
90 | | - numbered, |
91 | | - openlevel=0 |
92 | | - } |
93 | | - \begin{appendices} |
94 | | - \bookmarksetupnext{level=part} |
95 | | - \ifthenelse{\equal{\showappendixsecindex}{true}}{}{ |
96 | | - \belowpdfbookmark{\nameappendixsection}{contents} |
97 | | - } |
98 | | - \setcounter{secnumdepth}{3} |
99 | | - \setcounter{tocdepth}{3} |
100 | | - \ifthenelse{\equal{\appendixindepobjnum}{true}}{ |
101 | | - \counterwithin{equation}{section} |
102 | | - \counterwithin{figure}{section} |
103 | | - \counterwithin{lstlisting}{section} |
104 | | - \counterwithin{table}{section}}{ |
105 | | - } |
106 | | - }{ |
107 | | - \end{appendices} |
108 | | - \bookmarksetupnext{level=0} |
109 | | - \endgroup |
110 | | -} |
111 | | - |
112 | | -% Inserta código fuente |
113 | | -% #1 Label (opcional) |
114 | | -% #2 Estilo de código |
115 | | -% #3 Caption |
116 | | -\lstnewenvironment{sourcecode}[3][]{ |
117 | | - \emptyvarerr{\equationresize}{#2}{Estilo no definido} |
118 | | - \ifthenelse{\equal{\showlinenumbers}{true}}{ |
119 | | - \rightlinenumbers}{ |
120 | | - } |
121 | | - \ifthenelse{\equal{#2}{c}}{}{ |
122 | | - \ifthenelse{\equal{#2}{csharp}}{}{ |
123 | | - \ifthenelse{\equal{#2}{c++}}{}{ |
124 | | - \ifthenelse{\equal{#2}{docker}}{}{ |
125 | | - \ifthenelse{\equal{#2}{html5}}{}{ |
126 | | - \ifthenelse{\equal{#2}{java}}{}{ |
127 | | - \ifthenelse{\equal{#2}{js}}{}{ |
128 | | - \ifthenelse{\equal{#2}{json}}{}{ |
129 | | - \ifthenelse{\equal{#2}{matlab}}{}{ |
130 | | - \ifthenelse{\equal{#2}{latex}}{}{ |
131 | | - \ifthenelse{\equal{#2}{perl}}{}{ |
132 | | - \ifthenelse{\equal{#2}{php}}{}{ |
133 | | - \ifthenelse{\equal{#2}{python}}{}{ |
134 | | - \ifthenelse{\equal{#2}{ruby}}{}{ |
135 | | - \ifthenelse{\equal{#2}{sql}}{}{ |
136 | | - \ifthenelse{\equal{#2}{xml}}{}{ |
137 | | - \def\sourcecodestyle {#2} |
138 | | - \throwbadconfig{Estilo de codigo desconocido}{\sourcecodestyle}{c,csharp,c++,docker,html5,java,js,json,matlab,latex,perl,php,python,ruby,sql,xml} |
139 | | - }}}}}}}}}}}}}}}} |
140 | | - \ifthenelse{\equal{\codecaptiontop}{true}}{ |
141 | | - \ifx\hfuzz#3\hfuzz |
142 | | - \lstset{ |
143 | | - style=#2, |
144 | | - captionpos=t |
145 | | - } |
146 | | - \else |
147 | | - \lstset{ |
148 | | - style=#2, |
149 | | - caption={#3 #1}, |
150 | | - captionpos=t |
151 | | - } |
152 | | - \fi |
153 | | - }{ |
154 | | - \ifx\hfuzz#3\hfuzz |
155 | | - \lstset{ |
156 | | - style=#2, |
157 | | - captionpos=b |
158 | | - } |
159 | | - \else |
160 | | - \lstset{ |
161 | | - style=#2, |
162 | | - caption={#3 #1}, |
163 | | - captionpos=b |
164 | | - } |
165 | | - \fi |
166 | | - } |
167 | | -}{ |
168 | | - \ifthenelse{\equal{\showlinenumbers}{true}}{ |
169 | | - \leftlinenumbers}{ |
170 | | - } |
171 | | -} |
172 | | - |
173 | | -\newcommand{\newquestionthemed}[2]{ |
174 | | - \emptyvarerr{\newquestion}{#1}{Titulo pregunta no definido} |
175 | | - \emptyvarerr{\newquestion}{#1}{Tema no definido} |
176 | | - \sectionanum{#1} |
177 | | - \vspace{-0.2cm} |
178 | | - \textbf{#2} |
179 | | - \newp |
180 | | -} |
181 | | - |
182 | | -\newcommand{\itempto}[2]{ |
183 | | - \ifthenelse{\equal{\bolditempto}{true}}{ |
184 | | - \item \textbf{(#1 pto)} #2 |
185 | | - }{ |
186 | | - \item (#1 pto) #2 |
187 | | - } |
188 | | -} |
| 14 | +\newcommand{\newquestion}[1]{\emptyvarerr{\newquestion}{#1}{Titulo pregunta no definido}\sectionanum{#1}}\newcommand{\newboxquestion}[1]{\emptyvarerr{\newquestion}{#1}{Titulo pregunta no definido}\phantomsection\newp \fbox{\ \textbf{#1}.-\ } \noindent\pdfbookmark[1]{#1}{toc}}\newenvironment{images}[2][]{\def\envimageslabelvar {#1}\def\envimagescaptionvar {#2}\def\envimagesinitialized {true}\vspace{\margintopimages cm}\captionsetup{margin=\captionmarginmultimg cm}\begin{figure}[H] \centering\vspace{-\marginrightmultimage cm}\vspace{-\marginrightmultimage cm}\vspace{-\marginrightmultimage cm}}{\setcaptionmargincm{\captionlrmargin}\ifx\hfuzz\envimagescaptionvar\hfuzz\vspace{\captionlessmarginimage cm}\else\caption{\envimagescaptionvar\envimageslabelvar}\fi\end{figure}\setcaptionmargincm{\captionlrmargin}\vspace{\marginbottomimages cm}\def\envimagesinitialized {false}}\def\envimagesinitialized {false}\newenvironment{references}{\ifthenelse{\equal{\stylecitereferences}{bibtex}}{}{\throwerror{\references}{Solo se puede usar entorno references con estilo citas \noexpand\stylecitereferences=bibtex}}\begingroup\ifthenelse{\equal{\donumrefsection}{true}}{\section{\namereferences}}{\sectionanum{\namereferences}}\renewcommand{\section}[2]{}\begin{thebibliography}{99}}{\end{thebibliography}\endgroup}\newenvironment{anexo}{\begingroup\clearpage\phantomsection\ifthenelse{\equal{\showappendixsectitle}{true}}{\appendixpage}{}\appendixtitleon\appendicestocpagenum\appendixtitletocon\bookmarksetup{numbered,openlevel=0}\begin{appendices}\bookmarksetupnext{level=part}\ifthenelse{\equal{\showappendixsecindex}{true}}{}{\belowpdfbookmark{\nameappendixsection}{contents}}\setcounter{secnumdepth}{3}\setcounter{tocdepth}{3}\ifthenelse{\equal{\appendixindepobjnum}{true}}{\counterwithin{equation}{section}\counterwithin{figure}{section}\counterwithin{lstlisting}{section}\counterwithin{table}{section}}{}}{\end{appendices}\bookmarksetupnext{level=0}\endgroup}\lstnewenvironment{sourcecode}[3][]{\emptyvarerr{\equationresize}{#2}{Estilo no definido}\ifthenelse{\equal{\showlinenumbers}{true}}{\rightlinenumbers}{}\ifthenelse{\equal{#2}{c}}{}{\ifthenelse{\equal{#2}{cpp}}{}{\ifthenelse{\equal{#2}{csharp}}{}{\ifthenelse{\equal{#2}{docker}}{}{\ifthenelse{\equal{#2}{html5}}{}{\ifthenelse{\equal{#2}{java}}{}{\ifthenelse{\equal{#2}{js}}{}{\ifthenelse{\equal{#2}{json}}{}{\ifthenelse{\equal{#2}{matlab}}{}{\ifthenelse{\equal{#2}{latex}}{}{\ifthenelse{\equal{#2}{perl}}{}{\ifthenelse{\equal{#2}{php}}{}{\ifthenelse{\equal{#2}{python}}{}{\ifthenelse{\equal{#2}{ruby}}{}{\ifthenelse{\equal{#2}{sql}}{}{\ifthenelse{\equal{#2}{xml}}{}{\def\sourcecodestyle {#2}\throwbadconfig{Estilo de codigo desconocido}{\sourcecodestyle}{c,cpp,csharp,docker,html5,java,js,json,matlab,latex,perl,php,python,ruby,sql,xml}}}}}}}}}}}}}}}}}\ifthenelse{\equal{\codecaptiontop}{true}}{\ifx\hfuzz#3\hfuzz\lstset{style=#2,captionpos=t}\else\lstset{style=#2,caption={#3 #1},captionpos=t}\fi}{\ifx\hfuzz#3\hfuzz\lstset{style=#2,captionpos=b}\else\lstset{style=#2,caption={#3 #1},captionpos=b}\fi}}{\ifthenelse{\equal{\showlinenumbers}{true}}{\leftlinenumbers}{}}\newcommand{\newquestionthemed}[2]{\emptyvarerr{\newquestion}{#1}{Titulo pregunta no definido}\emptyvarerr{\newquestion}{#1}{Tema no definido}\sectionanum{#1}\vspace{-0.2cm}\textbf{#2}\newp}\newcommand{\itempto}[2]{\ifthenelse{\equal{\bolditempto}{true}}{\item \textbf{(#1 pto)} #2}{\item (#1 pto) #2}} |
0 commit comments