mirror of
https://gitlab.com/netravnen/NetworkLabNotes.git
synced 2024-11-08 18:29:40 +00:00
111 lines
2.3 KiB
TeX
111 lines
2.3 KiB
TeX
% Usage: \pic[<pct-of-columnwidth>]{<path-to-file>}
|
|
\newcommand{\pic}[2][50]{
|
|
\begin{center}
|
|
\transparent{0.4}
|
|
\includegraphics[width=0.#1\columnwidth]{#2}
|
|
\end{center}
|
|
}
|
|
|
|
% Usage: \fig{<path-to-file>}{<label>}{<caption>}
|
|
\newcommand{\fig}[4][]{
|
|
\begin{figure}[h!]
|
|
\centering
|
|
\includegraphics[width=0.95\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}
|
|
}
|
|
|
|
\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: \svg{<path-to-file>}{<label>}{<caption>}
|
|
\newcommand{\svg}[3]{
|
|
\begin{figure}[h]
|
|
\centering
|
|
\includesvg{#1}
|
|
\caption{#3}
|
|
\label{fig:#2}
|
|
\end{figure}
|
|
}
|
|
|
|
\newcommand{\notice}[2]{%
|
|
\shadowbox{%
|
|
\begin{varwidth}{0.85\linewidth}
|
|
\texttt{\textbf{#1}}\\
|
|
#2
|
|
\end{varwidth}
|
|
}
|
|
}
|
|
|
|
\newcommand{\cliline}[2][]{\lstinline[columns=fixed,#1]{#2}}
|
|
|
|
\newcommand{\utccurrenttime}[0]{%
|
|
\today%
|
|
T%
|
|
\DTMcurrenttime%
|
|
\DTMfetchTZhour{now}%
|
|
:%
|
|
\DTMfetchTZminute{now}
|
|
}
|
|
|
|
|
|
\newcommand{\itemhead}[2][]{%
|
|
\sbox0{#1}%
|
|
\ifdim\wd0=0pt
|
|
{\textbf{#2:}} %if #1 is empty
|
|
\else
|
|
{\textbf{#2:}\\{\footnotesize #1}}
|
|
\fi
|
|
}
|
|
\newcommand{\itemtitle}[2]{%
|
|
\sbox0{#1}%
|
|
\ifdim\wd0=0pt
|
|
{\itemhead{#1}} %if #2 is empty
|
|
\else
|
|
{\itemhead[#2]{#1}}
|
|
\fi
|
|
}
|
|
|
|
|
|
\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
|
|
}
|
|
|
|
|
|
% Enviroment @var txt
|
|
% changes code styling to: in frame, white bg.
|
|
\lstnewenvironment{txt}{\lstset{style=plaintxt}}{}
|
|
|
|
|
|
% Enviroment @var cisco
|
|
\lstnewenvironment{cisco}{\lstset{language=cisco}}{}
|
|
|
|
|
|
%\newcommand{cisline}[1]{\lstinline[columns=fixed]{network-device\# #1}}
|
|
|
|
|
|
%\newcommand{cisconf}[2][]{%
|
|
%\def\temp{#1}\ifx\temp\empty
|
|
%\lstinline[columns=fixed]{network-device(config)\# #2}
|
|
%\else
|
|
%\lstinline[columns=fixed]{network-device(config-#1)\# #2}
|
|
%\fi\}
|
|
|
|
|
|
\newcommand{\txtreflect}[1]{\reflectbox{#1}}
|
|
\newcommand{\txtupdown}[1]{\raisebox{\depth}{\rotatebox{270}{\reflectbox{\rotatebox{90}{#1}}}}} |