mirror of
https://gitlab.com/netravnen/NetworkLabNotes.git
synced 2024-11-23 19:17:54 +00:00
132 lines
2.7 KiB
TeX
132 lines
2.7 KiB
TeX
% Usage: \fig{<path-to-file>}{<label>}{<caption>}
|
|
\newcommand{\fig}[4][]{
|
|
\begin{figure}[h!]
|
|
\centering
|
|
\includegraphics[width=0.8\columnwidth]{#2}
|
|
%
|
|
\sbox0{#1}%
|
|
\ifdim\wd0=0pt
|
|
{\caption{#4}} %if #1 is empty
|
|
\else
|
|
{\caption{#4\\\texttt{{\scriptsize #1}}}}
|
|
\fi
|
|
%
|
|
\label{fig:#3}
|
|
\end{figure}
|
|
}
|
|
|
|
|
|
% Usage:
|
|
\newcommand{\xkcd}[2]{\fig{xkcd/#1}{#1}{#2\\%
|
|
{\tiny\MakeUppercase{https://imgs.xkcd.com/comics/#1.png}\hskip3mm%
|
|
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\\%
|
|
{\tiny\href{https://commons.wikimedia.org/wiki/File:#2.svg}{\MakeUppercase{https://commons.wikimedia.org/wiki/File:#2.svg}}\hskip3mm%
|
|
License: \texttt{\href{https://creativecommons.org/licenses/by-sa/3.0/}{CC BY-SA 3.0}}}%
|
|
}}
|
|
|
|
|
|
% Usage:
|
|
\newcommand{\notice}[2]{%
|
|
\shadowbox{%
|
|
\begin{varwidth}{0.85\linewidth}
|
|
\texttt{\textbf{#1}}\\
|
|
#2
|
|
\end{varwidth}
|
|
}
|
|
}
|
|
|
|
|
|
% Usage:
|
|
\newcommand{\cliline}[2][]{\lstinline[columns=fixed,#1]{#2}}
|
|
|
|
|
|
% Usage:
|
|
\newcommand{\utccurrenttime}[0]{%
|
|
\today%
|
|
T%
|
|
\DTMcurrenttime%
|
|
\DTMfetchTZhour{now}%
|
|
:%
|
|
\DTMfetchTZminute{now}
|
|
}
|
|
|
|
|
|
% Usage:
|
|
\newcommand{\itemhead}[2][]{%
|
|
\sbox0{#1}%
|
|
\ifdim\wd0=0pt
|
|
{\textbf{#2:}} %if #1 is empty
|
|
\else
|
|
{\textbf{#2:}\\{\footnotesize #1}}
|
|
\fi
|
|
}
|
|
|
|
|
|
% Usage:
|
|
\newcommand{\itemtitle}[2]{%
|
|
\sbox0{#1}%
|
|
\ifdim\wd0=0pt
|
|
{\itemhead{#1}} %if #2 is empty
|
|
\else
|
|
{\itemhead[#2]{#1}}
|
|
\fi
|
|
}
|
|
|
|
|
|
% Usage:
|
|
\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
|
|
}
|
|
|
|
|
|
% Usage:
|
|
% Enviroment @var txt
|
|
% changes code styling to: in frame, white bg.
|
|
\lstnewenvironment{txt}{\lstset{style=plaintxt}}{}
|
|
|
|
|
|
% Usage:
|
|
% Enviroment @var cisco
|
|
\lstnewenvironment{cisco}{\lstset{language=cisco}}{}
|
|
|
|
|
|
% Usage:
|
|
\newcommand{\txtreflect}[1]{\reflectbox{#1}}
|
|
|
|
|
|
% Usage:
|
|
\newcommand{\txtupdown}[1]{\raisebox{\depth}{\rotatebox{270}{\reflectbox{\rotatebox{90}{#1}}}}}
|
|
|
|
|
|
% Usage: used in similair manner as itemize --> \begin{rules} then \end{rules}
|
|
% http://www.troubleshooters.com/linux/lyx/ownlists.htm
|
|
\newenvironment{rules}{
|
|
\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}
|
|
}
|
|
}{
|
|
\end{list}
|
|
}
|
|
|
|
|
|
% Usage:
|
|
\newcommand{\rfc}[1]{RFC #1\footnote{\url{https://tools.ietf.org/html/rfc#1}{tools.ietf.org/html/rfc#1}}}
|