subrepo:
  subdir:   "utils"
  merged:   "b9b8d76"
upstream:
  origin:   "https://gitlab.inria.fr/whar/packages/latex-utils"
  branch:   "main"
  commit:   "b9b8d76"
git-subrepo:
  version:  "0.4.6"
  origin:   "???"
  commit:   "???"
This commit is contained in:
2024-06-25 11:23:31 +02:00
parent baf300bf7a
commit 3dc506d9a9
3 changed files with 530 additions and 0 deletions

306
utils/.gitignore vendored Normal file
View File

@@ -0,0 +1,306 @@
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
*.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Include assets
!assets/**/*.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# comment
*.cut
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs
*.slg
*.slo
*.sls
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist
# gnuplot
*.gnuplot
*.table
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.glog
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
# *.tikz
*-tikzDictionary
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# newpax
*.newpax
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# svg
svg-inkscape/
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# titletoc
*.ptc
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices and outlines
*.xyc
*.xyd
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# gummi
.*.swp
# KBibTeX
*~[0-9]*
# TeXnicCenter
*.tps
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
# Makeindex log files
*.lpz
# xwatermark package
*.xwm
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib
**/__latexindent_temp_main.tex

12
utils/.gitrepo Normal file
View File

@@ -0,0 +1,12 @@
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
;
[subrepo]
remote = https://gitlab.inria.fr/whar/packages/latex-utils
branch = main
commit = b9b8d7645fb1c4c6cfe22399a064f6551512f0bf
parent = baf300bf7a0addbf162a5b4535d49772e03da87a
method = merge
cmdver = 0.4.6

212
utils/commands.tex Normal file
View File

@@ -0,0 +1,212 @@
%% Packages required
\usepackage[export]{adjustbox} % For valign in subfigs
\usepackage[caption=false]{subfig} % Good looking subfigs
%% Abbreviations
\newcommand{\etal}{\textit{et al.}}
\newcommand{\eg}{\textit{e.g.},\ }
\newcommand{\ie}{\textit{i.e.},\ }
\newcommand{\ns}{\textit{n.s.}}
\newcommand{\x}{\texttimes\ }
\newcommand{\vs}{\textit{vs.}\ }
%% Citations
\newcommand{\citeauthorcite}[1]{\citeauthor*{#1}~\cite{#1}}
%% Figures
% example: \fig[1]{universe}{The Universe}[Short title for list of figures]
% reference later with: \figref{universe}
\NewDocumentCommand{\fig}{O{0.8} O{htbp} m m O{#4}}{%
\begin{figure}[#2]
\centering%
\includegraphics[width=#1\linewidth]{#3}%
\caption[#5]{#4}%
\label{fig:#3}%
\end{figure}%
}
\NewDocumentCommand{\figwide}{O{1} O{htbp} m m O{#4}}{%
\begin{figure*}[#2]
\centering%
\includegraphics[width=#1\linewidth]{#3}%
\caption[#5]{#4}%
\label{fig:#3}%
\end{figure*}%
}
\newcommand{\figref}[1]{Fig.~\ref{fig:#1}}
%% Sub-figures
% example:
% \begin{subfigs}{label}{Title}[Short title for list of figures]
% \subfig[1]{hands-none}[None]%
% \subfig[1]{hands-occlusion}[Occlusion]%
% \end{subfigs}
% reference later with: \figref{label}
\NewDocumentEnvironment{subfigs}{O{htbp} m m O{#3}}{%
\begin{figure}[#1]%
\centering%
}{%
\caption[#4]{#3}%
\label{fig:#2}%
\end{figure}%
}
\NewDocumentEnvironment{subfigswide}{O{htbp} m m O{#3}}{%
\begin{figure*}[#1]%
\centering%
}{%
\caption[#4]{#3}%
\label{fig:#2}%
\end{figure*}%
}
\NewDocumentCommand{\subfig}{O{0.2} o O{b} m}{%
\IfValueTF{#2}{%
\subfloat[#2\label{fig:#4}]{\includegraphics[width=#1\linewidth,valign=#3]{#4}}%
}{%
\subfloat{\includegraphics[width=#1\linewidth,valign=#3]{#4}}%
}%
\hfill%
}
\newcommand{\topleftsubcaption}{%
\captionsetup[subfigure]{
position=top,
justification=raggedright,
singlelinecheck=off, % do not center single line captions
labelfont={scriptsize,sf,md,up}, % smallest size, sans-serif, bold, upright
%labelformat=simple, % do not add parentheses
farskip=0pt, % no space between caption and figure
captionskip=0pt, % no space between caption and subfigure
margin=3pt % align caption with subfigure
}%
}
\newcommand{\hidesubcaption}{%
\captionsetup[subfigure]{
position=top,
justification=raggedright,
labelfont={scriptsize}, % smallest size
farskip=0pt, % no space between caption and figure
captionskip=-10pt, % no space between caption and subfigure
margin=4pt % align caption with subfigure
}%
}
%% Footnotes
\newcommand{\footnoteurl}[1]{\footnote{\ \url{#1}}}
%% Lists
\renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textit{#1}} % Use italics instead of bold for descriptions
%% Maths
\renewcommand{\eqref}[1]{Eq.~\ref{eq:#1}}
\newcommand{\measure}[3]{$\mathrm{#1} = \qty{#2}{#3}$}
\newcommand{\chisqr}[3]{$\chi^2(#1, N=#2) = #3$}
\newcommand{\anova}[3]{$\mathrm{F(#1, #2)} = #3$}
\newcommand{\ci}[2]{$\mathrm{CI} = [#1, #2]$}
\newcommand{\friedman}[1]{$\chi^2 = #1$}
\newcommand{\geomean}[2]{\measure{GM}{#1}{#2}}
\newcommand{\iqr}[2]{\measure{IQR}{#1}{#2}}
\newcommand{\kendall}[1]{\measure{\tau}{#1}{}}
\newcommand{\kruskal}[1]{\measure{H}{#1}{}}
\newcommand{\mean}[2]{\measure{M}{#1}{#2}}
\newcommand{\median}[2]{\measure{Mdn}{#1}{#2}}
\newcommand{\p}[2][=]{$\mathrm{p} #1 #2$}
\newcommand{\pinf}[1]{\p[<]{#1}}
\newcommand{\percent}[1]{\qty{#1}{\%}}
\newcommand{\pearson}[1]{\measure{r}{#1}{}}
\newcommand{\sd}[1]{\measure{SD}{#1}{}}
\newcommand{\spearman}[1]{\measure{r_s}{#1}{}}
\newcommand{\tabCI}[2]{{[}#1{,}\,#2{]}}
\newcommand{\ttest}[2]{$\mathrm{t}(#1) = #2$}
\newcommand{\wilcoxon}[1]{\measure{W}{#1}{}}
% From https://tex.stackexchange.com/a/95842
\newenvironment{conditions}{%
\par% maybe you want the list to start with a new line
\vspace{\abovedisplayskip}% some space before
\noindent% don't indent
\tabularx{\linewidth}{>{$}l<{$} @{${}={}$} X@{}}% three columns left-aligned; first one is math-mode, the middle is an equals sign, and the last one is normal
}{%
\endtabularx%
\par% maybe you want the list to end with a new line
\vspace{\belowdisplayskip}% some space after
}
%% References
\newcommand{\secref}[1]{Sec.~\ref{sec:#1}}
%% Structure
\newcommand{\chapterstartoc}[1]{\chapter*{#1}\addcontentsline{toc}{chapter}{#1}}
\newcommand{\sectionstartoc}[1]{\section*{#1}\addcontentsline{toc}{section}{#1}}
\newcommand{\subsectionstartoc}[1]{\subsection*{#1}\addcontentsline{toc}{subsection}{#1}}
\newcommand{\subsubsubsection}[1]{\paragraph*{\textit{#1}}}
%% Tables
% example:
% \begin{tab}{label}{Title}
% \begin{tabular}{cc}
% \hline
% \textbf{1} & \textbf{2} \\ \hline
% 3 & 4 \\ \hline
% \end{tabular}
% \end{tab}
% reference later with: \tabref{label}
\NewDocumentEnvironment{tab}{m m}{%
\begin{table}%
\begin{center}
\caption{#2}%
\label{tab:#1}%
}{%
\end{center}%
\end{table}%
}
\NewDocumentEnvironment{tabwide}{m m}{%
\begin{table*}%
\begin{center}
\caption{#2}%
\label{tab:#1}%
}{%
\end{center}%
\end{table*}%
}
\newcommand{\tabrow}[1]{#1 \\ \hline}
\newcommand{\tabref}[1]{Table~\ref{tab:#1}}