2017-05-23 09:01:04 +00:00
|
|
|
% Usage: \fig{<path-to-file>}{<label>}{<caption>}
|
2017-06-05 19:36:04 +00:00
|
|
|
\newcommand{\fig}[4][]{
|
2017-05-24 17:10:55 +00:00
|
|
|
\begin{figure}[h!]
|
2017-05-23 09:01:04 +00:00
|
|
|
\centering
|
2017-06-07 10:31:59 +00:00
|
|
|
\includegraphics[width=0.8\columnwidth]{#2}
|
2017-06-05 19:36:04 +00:00
|
|
|
%
|
|
|
|
\sbox0{#1}%
|
|
|
|
\ifdim\wd0=0pt
|
|
|
|
{\caption{#4}} %if #1 is empty
|
|
|
|
\else
|
|
|
|
{\caption{#4\\\texttt{{\scriptsize #1}}}}
|
|
|
|
\fi
|
|
|
|
%
|
|
|
|
\label{fig:#3}
|
2017-05-23 09:01:04 +00:00
|
|
|
\end{figure}
|
|
|
|
}
|
|
|
|
|
2017-06-17 23:52:22 +00:00
|
|
|
|
|
|
|
% Usage:
|
2017-06-01 09:40:35 +00:00
|
|
|
\newcommand{\xkcd}[2]{\fig{xkcd/#1}{#1}{#2\\%
|
2017-06-06 06:38:16 +00:00
|
|
|
{\tiny\MakeUppercase{https://imgs.xkcd.com/comics/#1.png}\hskip3mm%
|
2017-06-18 12:55:52 +00:00
|
|
|
License: \texttt{\href{https://creativecommons.org/licenses/by-nc/2.5/}{CC BY-NC 2.5}}}%
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
|
|
% Usage:
|
|
|
|
\newcommand{\wikicommons}[2][]{\fig{wikimediacommons/#2}{#2}{#1\\%
|
2017-06-18 19:05:58 +00:00
|
|
|
{\tiny\href{https://commons.wikimedia.org/wiki/File:#2.svg}{\MakeUppercase{https://commons.wikimedia.org/wiki/File:#2.svg}}\hskip3mm%
|
2017-06-18 12:55:52 +00:00
|
|
|
License: \texttt{\href{https://creativecommons.org/licenses/by-sa/3.0/}{CC BY-SA 3.0}}}%
|
|
|
|
}}
|
2017-06-01 09:40:35 +00:00
|
|
|
|
2017-05-23 09:01:04 +00:00
|
|
|
|
2017-06-17 23:52:22 +00:00
|
|
|
% Usage:
|
2017-05-23 09:01:04 +00:00
|
|
|
\newcommand{\notice}[2]{%
|
|
|
|
\shadowbox{%
|
|
|
|
\begin{varwidth}{0.85\linewidth}
|
|
|
|
\texttt{\textbf{#1}}\\
|
|
|
|
#2
|
|
|
|
\end{varwidth}
|
|
|
|
}
|
|
|
|
}
|
2017-05-24 22:37:49 +00:00
|
|
|
|
2017-06-17 23:52:22 +00:00
|
|
|
|
|
|
|
% Usage:
|
2017-05-24 22:37:49 +00:00
|
|
|
\newcommand{\cliline}[2][]{\lstinline[columns=fixed,#1]{#2}}
|
|
|
|
|
2017-06-17 23:52:22 +00:00
|
|
|
|
|
|
|
% Usage:
|
2017-05-24 22:37:49 +00:00
|
|
|
\newcommand{\utccurrenttime}[0]{%
|
2017-05-30 13:03:30 +00:00
|
|
|
\today%
|
|
|
|
T%
|
|
|
|
\DTMcurrenttime%
|
|
|
|
\DTMfetchTZhour{now}%
|
|
|
|
:%
|
|
|
|
\DTMfetchTZminute{now}
|
|
|
|
}
|
|
|
|
|
2017-06-05 20:06:29 +00:00
|
|
|
|
2017-06-17 23:52:22 +00:00
|
|
|
% Usage:
|
2017-06-05 20:06:29 +00:00
|
|
|
\newcommand{\itemhead}[2][]{%
|
|
|
|
\sbox0{#1}%
|
|
|
|
\ifdim\wd0=0pt
|
|
|
|
{\textbf{#2:}} %if #1 is empty
|
|
|
|
\else
|
|
|
|
{\textbf{#2:}\\{\footnotesize #1}}
|
|
|
|
\fi
|
|
|
|
}
|
2017-06-17 23:52:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
% Usage:
|
2017-06-04 17:16:36 +00:00
|
|
|
\newcommand{\itemtitle}[2]{%
|
2017-06-05 20:06:29 +00:00
|
|
|
\sbox0{#1}%
|
|
|
|
\ifdim\wd0=0pt
|
|
|
|
{\itemhead{#1}} %if #2 is empty
|
|
|
|
\else
|
|
|
|
{\itemhead[#2]{#1}}
|
|
|
|
\fi
|
2017-06-04 17:16:36 +00:00
|
|
|
}
|
2017-05-30 19:50:54 +00:00
|
|
|
|
|
|
|
|
2017-06-17 23:52:22 +00:00
|
|
|
% Usage:
|
2017-05-31 14:11:03 +00:00
|
|
|
\newcommand{\myquote}[2]{%
|
|
|
|
\sbox0{#1}%
|
|
|
|
\ifdim\wd0=0pt
|
|
|
|
{\epigraph{#2}{\textit{{\tiny \theauthor}}}} %if #1 is empty
|
|
|
|
\else
|
|
|
|
{\epigraph{#2}{\textit{#1}}} %if quote is cited
|
|
|
|
\fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-17 23:52:22 +00:00
|
|
|
% Usage:
|
2017-05-30 19:50:54 +00:00
|
|
|
% Enviroment @var txt
|
|
|
|
% changes code styling to: in frame, white bg.
|
2017-05-30 20:25:51 +00:00
|
|
|
\lstnewenvironment{txt}{\lstset{style=plaintxt}}{}
|
|
|
|
|
|
|
|
|
2017-08-07 20:37:28 +00:00
|
|
|
|
2017-06-17 23:52:22 +00:00
|
|
|
% Usage:
|
2017-05-30 20:25:51 +00:00
|
|
|
% Enviroment @var cisco
|
2017-06-04 00:38:06 +00:00
|
|
|
\lstnewenvironment{cisco}{\lstset{language=cisco}}{}
|
2017-06-03 12:58:04 +00:00
|
|
|
|
|
|
|
|
2017-06-17 23:52:22 +00:00
|
|
|
% Usage:
|
|
|
|
\newcommand{\txtreflect}[1]{\reflectbox{#1}}
|
2017-06-06 05:37:21 +00:00
|
|
|
|
|
|
|
|
2017-06-17 23:52:22 +00:00
|
|
|
% Usage:
|
2017-06-10 14:24:28 +00:00
|
|
|
\newcommand{\txtupdown}[1]{\raisebox{\depth}{\rotatebox{270}{\reflectbox{\rotatebox{90}{#1}}}}}
|
|
|
|
|
|
|
|
|
2017-06-17 23:52:22 +00:00
|
|
|
% Usage: used in similair manner as itemize --> \begin{rules} then \end{rules}
|
2017-06-10 14:24:28 +00:00
|
|
|
% http://www.troubleshooters.com/linux/lyx/ownlists.htm
|
|
|
|
\newenvironment{rules}{
|
2017-06-17 23:52:22 +00:00
|
|
|
\begin{list}%
|
|
|
|
{\bfseries{}§\hskip1mm\arabic{qcounter}:~}%
|
|
|
|
{
|
|
|
|
\usecounter{qcounter}
|
|
|
|
\bfseries
|
|
|
|
\setlength\labelwidth{1in}
|
|
|
|
\setlength\labelsep{0.27in}
|
|
|
|
\setlength\leftmargin{0.56in}
|
|
|
|
\setlength\listparindent{1in}
|
|
|
|
\setlength\itemindent{0.1in}
|
|
|
|
}
|
2017-06-10 14:24:28 +00:00
|
|
|
}{
|
2017-06-17 23:52:22 +00:00
|
|
|
\end{list}
|
2017-06-10 14:24:28 +00:00
|
|
|
}
|
2017-06-18 20:16:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
% Usage:
|
2017-06-24 11:17:35 +00:00
|
|
|
\newcommand{\rfc}[1]{RFC #1\footnote{\href{https://tools.ietf.org/html/rfc#1}{tools.ietf.org/html/rfc#1}}}
|
2017-06-30 06:22:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
% Usage: \note{<text>} or \nb{<text>}
|
|
|
|
\newcommand{\note}[1]{{\color{Mahogany!20!black}{\small(#1)}}}
|
2017-08-19 09:02:10 +00:00
|
|
|
\newcommand{\nb}[1]{\note{#1}}
|
|
|
|
|
|
|
|
|
2017-08-07 20:37:28 +00:00
|
|
|
% Usage:
|
|
|
|
% https://tex.stackexchange.com/a/75349
|
|
|
|
\newcommand{\plaintextinput}[1]{\lstinputlisting[language={},style=plaintxt]{code/#1.txt}}
|