Created
January 6, 2022 19:01
-
-
Save jpdias/b033dc62e7283839e6596168229c2f1d to your computer and use it in GitHub Desktop.
Latex helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% abbrevs. | |
\newcommand{\etal}{\emph{et~al}. } | |
\newcommand{\ie}{\emph{i}.\emph{e}., } | |
\newcommand{\eg}{\emph{e}.\emph{g}., } | |
\newcommand{\cf}{\emph{cf}. } | |
\newcommand{\viz}{viz. } | |
\usepackage{stringstrings} | |
\newcommand{\pattern}[1]{\textsc{\capitalizetitle{#1}}} | |
\newcommand{\doctitle}[1]{\textsc{\MakeLowercase{#1}}} | |
%% figures and other floats | |
\newcounter{cPage} | |
\newcommand\optref[1]{% | |
\refstepcounter{cPage}\label{current\thecPage}% | |
\ifthenelse{\equal{\pageref{#1}}{\pageref{current\thecPage}}}% | |
{}{~(p.~\pageref{#1})}% | |
} | |
\newcounter{cfPage} | |
\newcommand\optcfref[1]{% | |
\refstepcounter{cfPage}\label{current\thecfPage}% | |
\ifthenelse{\equal{\pageref{#1}}{\pageref{current\thecfPage}}}% | |
{}{, p.~\pageref{#1}}% | |
} | |
\newcommand\coderef[1]{Source~\ref{#1}\optref{#1}} | |
\newcommand\listingref[1]{Listing~\ref{#1}\optref{#1}} | |
\newcommand\figureref[1]{Figure~\ref{#1}\optref{#1}} | |
\newcommand\tableref[1]{Table~\ref{#1}\optref{#1}} | |
\newcommand\algref[1]{Algorithm~\ref{#1}\optref{#1}} | |
\newcommand\chapterref[1]{Chapter~\ref{#1}\optref{#1}} | |
\newcommand\partref[1]{Part~\ref{#1}\optref{#1}} | |
\newcommand\annexref[1]{Appendix~\ref{#1}\optref{#1}} | |
\newcommand\sectionref[1]{\textsection~\ref{#1}\optref{#1}} | |
\newcommand\insectionref[1]{Section~\ref{#1}\optcfref{#1}} | |
\newcommand\inpartref[1]{Part~\ref{#1}\optcfref{#1}} | |
\newcommand\inalgref[1]{Algorithm~\ref{#1}\optcfref{#1}} | |
\newcommand\infigureref[1]{Figure~\ref{#1}\optcfref{#1}} | |
\newcommand\intableref[1]{Table~\ref{#1}\optcfref{#1}} | |
\newcommand\inlistingref[1]{Listing~\ref{#1}\optcfref{#1}} | |
\newcommand\inchapterref[1]{Chapter~\ref{#1}\optcfref{#1}} | |
\newcommand\inannexref[1]{Appendix~\ref{#1}\optcfref{#1}} | |
\newcommand\seesectionref[1]{(\emph{cf.} Section~\ref{#1}\optcfref{#1})} | |
\newcommand\seepartref[1]{(\emph{cf.} Part~\ref{#1}\optcfref{#1})} | |
\newcommand\seealgref[1]{(\emph{cf.} Algorithm~\ref{#1}\optcfref{#1})} | |
\newcommand\seefigureref[1]{(\emph{cf.} Figure~\ref{#1}\optcfref{#1})} | |
\newcommand\seetableref[1]{(\emph{cf.} Table~\ref{#1}\optcfref{#1})} | |
\newcommand\seelistingref[1]{(\emph{cf.} Listing~\ref{#1}\optcfref{#1})} | |
\newcommand\seechapterref[1]{(\emph{cf.} Chapter~\ref{#1}\optcfref{#1})} | |
\newcommand\seeannexref[1]{(\emph{cf.} Appendix~\ref{#1}\optcfref{#1})} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment