Skip to content

Instantly share code, notes, and snippets.

@tapyu
Last active August 4, 2026 01:46
Show Gist options
  • Select an option

  • Save tapyu/886dc95fc19c4250fb38581ccc58bed8 to your computer and use it in GitHub Desktop.

Select an option

Save tapyu/886dc95fc19c4250fb38581ccc58bed8 to your computer and use it in GitHub Desktop.
General LaTeX snippets
  • General LaTeX snippets
  • Default preamble
  • Makefile
  • latexindent.yaml configuration
  • TeX Live Manager (tlmgr) installation guide

Since the glossaries entries are now meant to have contributions from different sources, it is now stored in this repository

%%% important comment keywords %%%
% CAVEAT: -> a warning concerning some compilation issues that may break your system in some situation
% ADJUST: -> manual tweaks that you may want to change
% TODO: -> to-do list
% HACK: -> Savy macros to easily use a given packages
%%%%%%%%% Document language %%%%%%%%%
% \usepackage[utf8]{inputenc} % ADJUST: descomente esta linha para mudar o idioma do texto para Português
% \usepackage[portuguese]{babel}
% \usepackage{cmap} % must be loaded before fontenc; embeds a proper ToUnicode CMap so copy-pasted text from the PDF isn't garbled
% \usepackage[T1]{fontenc} % single-glyph accented characters (instead of OT1's composite accents), required together with cmap for correct copy-paste
%%%%%%%%% bibliography %%%%%%%%%
\usepackage[style=numeric-comp,backend=biber]{biblatex} % tells LaTeX to use the biber tool instead of the traditional bibtex tool for sorting and formatting your bibliography. Biber is a more advanced and powerful tool than bibtex and it provides more features, such as advanced sorting, Unicode support and support for various data sources.
\addbibresource{refs.bib} % add reference file, in the document, add \printbibliography to print bibliography
%%%%%%%%% references (cite and glossary) %%%%%%%%%
\makeatletter
% some classes (e.g., beamer) loads hyperref by default. So it is sensible to check whether it wasn't already loaded to avoind clashes
\@ifpackageloaded{hyperref}{
% The package is already loaded
}{
% The package is not loaded, so load it now
\usepackage[colorlinks=true,hyperindex=false]{hyperref} % make references blue and clickable
}
\makeatother
\hypersetup{ % you can use allcolors=blue in hyperref options instead this setup
linkcolor=black, % For \gls{} entries
citecolor=blue, % For \cite{} entries
}
\usepackage{glossaries} % \newglossaryentry{} entries. ADJUST: If you want to make the glossary entries nonclickable, load this package before hyperref
% CAVEAT: don't use `glossaries-extra`, otherwise the conditional glossary entry will not work! % SEE: https://tex.stackexchange.com/questions/98494/glossaries-dont-print-single-occurences/230664#230664
\glsenableentrycount % enable \cgls, \cglspl, \cGls, \cGlspl
% NOTE: use \cgls-based instead of \gls-based macros as the former puts the initials iff. it was used more than once.
% HACK:
% \glsentrylong{pll} -> long form
% add hyphened entries
% SEE: https://tex.stackexchange.com/a/311882/211183
\glsaddkey
{hyphenated} % new key
{\relax} % default value if "hyphenated" isn't used in \newglossaryentry
{\cglsentryhyph} % analogous to \cglsentrytext
{\cGlsentryhyph} % analogous to \cGlsentrytext
{\cglshyph} % analogous to \cglstext
{\cGlshyph} % analogous to \cGlstext
{\cGLShyph} % analogous to \cGLStext
\let\origcglshyph\cglshyph
\renewcommand{\cglshyph}[1]{%
\glsadd{#1}% mark used for glossary inclusion
\origcglshyph{#1}% original hyphenated display
% mark a flag macro for this label
\expandafter\gdef\csname glsHyphUsed@#1\endcsname{1}%
}
% preserve original \cgls and override to consult the hyphen flag
\let\origcgls\cgls
\renewcommand{\cgls}[1]{%
\ifcsname glsHyphUsed@#1\endcsname
\glsentryshort{#1}% print short form if hyphenated use occurred
\else
\origcgls{#1}% otherwise use original behaviour
\fi
}
%%%%%%%%% list of authors %%%%%%%%%
\makeatletter
\@ifclassloaded{beamer}{}{%
\usepackage{authblk} % CAVEAT: this pkg will lead to compilation errors if you use it along with `\IEEEauthorblockN`, which is a command from the `IEEEtran` document class
}
\makeatother
%%%%%%%%% items, tables and figs %%%%%%%%%
\makeatletter
% only load enumitem if not already present (sbrt.cls provides \labelindent)
\@ifpackageloaded{enumitem}{}{\@ifundefined{labelindent}{\usepackage{enumitem}}{}}
\makeatother
\usepackage{xltabular}
\usepackage{float} % use the [H] option
\usepackage{tikz}
\usepackage{graphicx} % extends the basic LaTeX graphic capabilities: placement, scaling, rotation, file formats
\usepackage{svg} % \includesvg{}; % NOTE: requires inkscape and compilation with --shell-escape
\usepackage{subcaption} % provides a means of using the subfigures environment, allowing a figure to be subdivided into smaller parts
\usepackage{standalone} % place tikz environments or other material in own source files
%%%%%%%%% new features %%%%%%%%%
\usepackage{xparse} % create commands with optional arguments or complex argument structures
\usepackage{xstring} % testing a string's contents, extracting substrings, substitution of substrings
%%%%%%%%% math %%%%%%%%%
\newcommand\bmmax{0} \newcommand\hmmax{0} % fix the "Too many math alphabets used in version normal" error (see https://tex.stackexchange.com/a/243541/211183)
\usepackage{amsmath}
\usepackage{mathtools} % is an extension package to amsmath to use \DeclarePairedDelimiter
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{esint} % provides extended integral symbols, giving you access to a wider variety of integral signs, such as double, triple, quadruple integrals
% HACK:
% \oiint -> contour integral
\usepackage{newtxmath} % for Greek variants (bold, nonitalic, etc...). E.g., `\boldsymbol{\betaup}`
\usepackage{stmaryrd} % provides new symbols, such as \llbracket \rrbracket
\usepackage{bm} % for writing tensor, e.g., $\bm{\mathcal{A}}$
% only load IEEEtrantools if the class did not already provide IEEEeqnarray
\makeatletter
\@ifpackageloaded{IEEEtrantools}{}{\@ifundefined{IEEEeqnarray}{\usepackage{IEEEtrantools}}{}}
\makeatother
\usepackage{siunitx} % typesetting units and unitless numbers SI (Système International d’Unités) units
% CAVEAT: you cannot use siunitx for nonnumerical values, e.g. \qty{\pi}{\meter\per\second}
% HACK:
% \qty -> number and unit, e.g., \qty{10}{\meter\per\second}
% \unit{} -> unit only, e.g., \unit{\meter\per\second}
% Examples:
% 1. \qtyrange[exponent-to-prefix=true, range-independent-prefix=true]{138e6}{2.9e9}{\hertz} -> 138 MHz to 2.9 GHz
% use, possible options:
% 1. "range-phrase=-" -> change the word "to" to "--"
% 2. range-units=single -> chage "1m to 10m" to "1 to 10m"
% 3. mode=text % writes the unit in full
% 4. quantity-product={-} to create a compound adjective with quantities, e.g. "the 50-Hz signal..."
% use the [per-mode=symbol] option in the \unit or \qty command to change the writing of \per, or change the line below to set it globally
\sisetup{per-mode=symbol} % print the symbol "/" in "25/100"
\sisetup{tight-spacing=true} % makes the spacing in "5 x 10²" closer
% \squared -> ^2
\usepackage{physics} % several math macros, such as
\AtBeginDocument{\RenewCommandCopy\qty\SI} % CAVEAT: avoid incompatibilities between physics and siunitx packages when using the \qty{}{} command. The conflict happens because it is defined in both packages. Although physics has \SI{}{} as an alternative, it is deprecated and therefore you should use \unit{} and \qty{}{} instead of \si{} and \SI{}{}, respectively. See here (https://tex.stackexchange.com/questions/628183/how-to-avoid-qty-conflict-with-physics-and-siunitx) for more info.
% HACK:
% \tr -> trace
% \rank -> rank
% \expval -> angle brackets to inner product,〈a,b〉, or ensemble average〈s(t)〉
% \abs -> |x|
% \norm -> ||x||
% \eval -> evaluated bar x|_y=a
% \order -> Big-O notation
% \Re -> real
% \Im -> imaginary
% \dd[]{} -> differential
% \dv -> derivative
% \pdv -> partial derivative
%%%%%%%%% operators %%%%%%%%%
\let\oldemptyset\emptyset % change empty set
\let\emptyset\varnothing
% circular convolution a lá Oppenheim (if possible, prefer \circledast)
\newcommand*\circconv[1]{%
\begin{tikzpicture}
\node[draw,circle,inner sep=1pt] {#1};
\end{tikzpicture}}
\newcommand{\intersection}{\bigcap\limits} % intersection operator
%%%%%%%%% delimiters %%%%%%%%%
\makeatletter % changes the catcode of @ to 11
\DeclarePairedDelimiter\ceil{\lceil}{\rceil} % ⌈x⌉
\let\oldceil\ceil
\def\ceil{\@ifstar{\oldceil}{\oldceil*}} % swap the asterisk and the nonasterisk behaviors
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor} % ⌊x⌋
\let\oldfloor\floor
\def\floor{\@ifstar{\oldfloor}{\oldfloor*}}
\makeatother % changes the catcode of @ back to 12
%%%%%%%%% basic functions %%%%%%%%%
\newcommand{\adj}[1]{\ensuremath{\operatorname{adj}\left(#1\right)}} % adjugate matrix
\newcommand{\cof}[1]{\ensuremath{\operatorname{cof}\left(#1\right)}} % cofactor matrix
\newcommand{\eig}[1]{\ensuremath{\operatorname{eig}\left(#1\right)}} % eigenvalues
\newcommand{\nullspace}[1]{\ensuremath{\operatorname{N}\left(#1\right)}} % nullspace or kernel of the matrix
\newcommand{\nullity}[1]{\ensuremath{\operatorname{nullity}\left(#1\right)}} % nullity=dim(N(A))
\newcommand{\spn}[1]{\ensuremath{\operatorname{span}\left\{#1\right\}}} % span of a set of vectors, \span is a reserved word
\newcommand{\range}[1]{\ensuremath{\operatorname{C}\left(#1\right)}} % range or columnspace of a matrix=span(a1,a2, ..., an), where ai is the ith column vector of the matrix A
\newcommand{\unvec}[1]{\ensuremath{\operatorname{unvec}\left(#1\right)}} % unvectorize operator
\newcommand{\diag}[1]{\ensuremath{\operatorname{diag}\left(#1\right)}} % diagonal operator
\newcommand{\blkdiag}[1]{\ensuremath{\operatorname{blkdiag}\left(#1\right)}} % block diagonal operator
\newcommand{\dom}[1]{\ensuremath{\operatorname{dom}\left(#1\right)}} % domain of the function
\newcommand{\frob}[1]{\ensuremath{\norm{#1}_\textrm{F}}} % Frobenius norm
\renewcommand{\dim}[1]{\ensuremath{\operatorname{dim}\left(#1\right)}} % dimension of a set
%%%%%%%%% customizable functions %%%%%%%%%
% arg min
\NewDocumentCommand{\argmin}{ e{_} m }{% \argmin_{x ∈ A}{f(x)} or \argmin{f(x)}
\ensuremath{%
\IfValueTF{#1}{%
\mathop{\operatorname{arg\,min}}\limits_{#1}\;#2
}{% else
\operatorname{arg\,min}\;#2
}
}
}
% arg max
\NewDocumentCommand{\argmax}{ e{_} m }{% \argmax_{x ∈ A}{f(x)} or \argmax{f(x)}
\ensuremath{%
\IfValueTF{#1}{%
\mathop{\operatorname{arg\,max}}\limits_{#1}\;#2
}{% else
\operatorname{arg\,max}\;#2
}
}
}
% limit in the mean (see Van Tress, chapter 6)
\NewDocumentCommand{\limean}{ E{_}{{}} m }{ % \limean_{x ∈ A}{f(x)} or \limean{f(x)}
\ensuremath{
\IfValueTF{#1}{%
\underset{#1}{\operatorname{l.i.m.}\;#2}
}{% else
\operatorname{l.i.m.}\;#2
}
}
}
% mean
\NewDocumentCommand{\E}{ E{_}{{}} o m }{% \E{A}, \E_{u}{A}. If you want only the left or right part of \E (useful for breaking line) you can use \E_{u}[left-only]{A} or \E_{u}[right-only]{A}, respectively
\ensuremath{%
\IfValueTF{#2}{%
\IfStrEq{#2}{left-only}{%
\operatorname{E}_{#1}\left[#3\right.%
}{% right-only
\left.#3\right]%
}%
}{%
\operatorname{E}_{#1}\left[#3\right]%
}%
}
}
% covariance
\NewDocumentCommand{\cov}{O{} m}{\ensuremath{\operatorname{cov}_{#1}\left[#2\right]}} % \cov[u]{x} or \cov{x}
% variance
\let\var\undefined\NewDocumentCommand{\var}{O{} m}{\ensuremath{\operatorname{var}_{#1}\left[#2\right]}} % \var[u]{x} or \var{x}
% vectorize operator
\let\vec\undefined\NewDocumentCommand{\vec}{O{} m}{\ensuremath{\operatorname{vec}_{#1}\left(#2\right)}} % \vec[u]{\mathbf{A}}, [u] is optional
% arg
\RenewDocumentCommand{\arg}{ s m }{% \arg{f(x)} -> arg(f(x)) \arg*{f(x)} -> arg f(x)
\ensuremath{%
\IfBooleanTF{#1}{\operatorname{arg} #2}{\operatorname{arg}\left(#2\right)}%
}
}
% normalize all trigonometry functions (new and predefined) to put a parenthesis around the input argument
\RenewDocumentCommand{\sin}{s m}{% \sin{x} -> sin(x) \sin*{x} -> sin x
\ensuremath{
\IfBooleanTF{#1}{\operatorname{sin} #2}{\operatorname{sin}\left(#2\right)}%
}
}
\RenewDocumentCommand{\cos}{s m}{% \cos{x} -> cos(x) \cos*{x} -> cos x
\ensuremath{
\IfBooleanTF{#1}{\operatorname{cos} #2}{\operatorname{cos}\left(#2\right)}%
}
}
\RenewDocumentCommand{\tan}{s m}{% \tan{x} -> tan(x) \tan*{x} -> tan x
\ensuremath{
\IfBooleanTF{#1}{\operatorname{tan} #2}{\operatorname{tan}\left(#2\right)}%
}
}
\NewDocumentCommand{\sinc}{s m}{% \sinc{x} -> sinc(x) \sinc*{x} -> sinc x
\ensuremath{
\IfBooleanTF{#1}{\operatorname{sinc} #2}{\operatorname{sinc}\left(#2\right)}%
}
}
\NewDocumentCommand{\sgn}{s m}{% \sgn{x} -> sgn(x) \sng*{x} -> sgn x
\ensuremath{
\IfBooleanTF{#1}{\operatorname{sng} #2}{\operatorname{sgn}\left(#2\right)}%
}
}
\RenewDocumentCommand{\sec}{s m}{% \sec{x} -> sec(x) \sec*{x} -> sec x
\ensuremath{
\IfBooleanTF{#1}{\operatorname{sec} #2}{\operatorname{sec}\left(#2\right)}%
}
}
%%%%%%%%% minor adjusts in some mathematical symbols %%%%%%%%%
\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n} % newtxmath changes the font style of \mathcal. It prevents \mathcal from being changed
\let\oldforall\forall % put some spaces between the \forall command
\renewcommand{\forall}{\;\oldforall\;}
% fix the problem in putting integral limits above and below the int symbol
% SEE: https://tex.stackexchange.com/questions/148520/to-have-two-limits-in-double-integral
% HACK: \iint \limits_{-\infty}^{+\infty}
\makeatletter
%% make esint definition in line with amsmath
\@for\next:={int,iint,iiint,iiiint,dotsint,oint,oiint,sqint,sqiint,
ointctrclockwise,ointclockwise,varointclockwise,varointctrclockwise,
fint,varoiint,landupint,landdownint}\do{%
\expandafter\edef\csname\next\endcsname{%
\noexpand\DOTSI
\expandafter\noexpand\csname\next op\endcsname
\noexpand\ilimits@
}%
}
\makeatother
%%%%%%%%% comments, corrections, or revisions %%%%%%%%%
\usepackage{ifluatex} % handle lualatex-specific packages
\ifluatex
\usepackage{luacolor} % colour support based on LuaTEX’s
\usepackage[soul]{lua-ul} % provide underlining, strikethrough, and highlighting using features in LuaLATEX which avoid the restrictions imposed by other methods
\fi
\newcommand{\obs}[1]{\textcolor{red}{(#1)}} % observation
\newcommand{\secret}[1]{\makebox[0cm]{}} % inline comment
\newcommand{\sizecorr}[1]{\makebox[0cm]{\phantom{$\displaystyle #1$}}} % Used to seize the height of equation
\interfootnotelinepenalty=10000 % restrict the footnote to one page
// make vscode use the recipe contained in the Makefile instead using the internal recipes mechanism of latex-workshop
// you should put it in ./.vscode/settings.json
{
"latex-workshop.latex.external.build.command": "make"
}
// config VScode in order to make LaTeX run LuaLaTeX engine with bibLaTeX
//use XeLaTeX or LuaLaTeX (I prefer Lua, btw)
//ref: https://tex.stackexchange.com/questions/668851/which-font-should-i-use-to-get-julias-code-with-bold-letter-using-minted-in-xel
// it must be added inside .vscode/settings.json of the latex project directory
// these engines are required to compile several features that is incompatible with pdflatex, such as:
// \usepackage{minted} package for writing code
// \usepackage{luacolor} for provide underlining, strikethough, and highlighting using features in LuaLATEX which avoid the restrictions imposed by other methods
// \usepackage[soul]{lua-ul} for expand the functionality of coloring, e.g., highlighting, font coloring and strikeouting
{
"latex-workshop.latex.recipe.default": "lualatex -> biber -> lualatex*2",
"latex-workshop.latex.recipes": [
{
"name": "lualatex -> biber -> lualatex*2",
"tools": [
"lualatex",
// "biber", // uncomment these
// "lualatex", // lines if you
// "lualatex" // aren using biblatex with biber backend
]
}
],
"latex-workshop.latex.tools": [
{
"name": "lualatex",
"command": "lualatex",
"args": [
"--shell-escape", // makes it compatible with \usepackage{minted}
// "-synctex=1", // This enables the synctex feature, which allows for synchronization between the source LaTeX document and the resulting PDF file.
// "-interaction=nonstopmode", // errors and warnings will be displayed in the console output but compilation will not stop
// "-file-line-error", // provides the file name and line number where an error occurred.
"%DOC%"
]
},
{
"name": "biber",
"command": "biber",
"args": [
"%DOCFILE%"
]
}
],
}
% create abstract and keyword section
\documentclass{article}
\title{My title}
\author{My author}
\newcommand\keywords[1]{%
\begingroup
\let\and\\
\par
\noindent\textbf{Keywords:}\\#1\par
\endgroup
}
\begin{document}
\maketitle
\begin{abstract}
Lorem ipsum...
\end{abstract}
\keywords{one \and two \and three foo bar \and four $x^2$-foo}
\section{Introduction}
\end{document}
% click here for more info: https://github.com/gpoore/pythontex
% or here: https://github.com/Ossifragus/runcode
\documentclass{article}
\usepackage{pythontex}
\newcommand{\pymultiply}[2]{\py{#1*#2}}
\begin{document}
\begin{pycode}
print("Python says ``Hello!''")
\end{pycode}
$8 \times 256 = \pymultiply{8}{256}$
\end{document}
% add vertical or horizontal spaces (gaps) between the elements of a \bmatrix
% \setstackgap{L}{} for vertical spacing of baselines
% \setstacktabbedgap{} for horizontal spacing inside the matrices
% \lrgap for the spacing at the left and right extremities of the vectors/matrices.
\documentclass{article}
\usepackage{tabstackengine}
\stackMath
\setstackgap{L}{24pt} % vertical gap
\setstacktabbedgap{4pt} % horizontal gap
\def\lrgap{\kern6pt}
\def\xbracketVectorstack#1{\left[\lrgap\Vectorstack{#1}\lrgap\right]} % use it for vectors
\def\xbracketMatrixstack#1{\left[\lrgap\tabbedCenterstack{#1}\lrgap\right]} % use it for matrices
\begin{document}
\[
\xbracketVectorstack{
s'^{\mathrm{T}} \\
I_{p\times p}
}=
\xbracketMatrixstack{
A & B \\
C & D
}
\xbracketVectorstack{
s'^{\mathrm{T}} \\
I_{p\times p}
}
\]
\end{document}
% another solution (simpler)
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\renewcommand{\arraystretch}{2.6} \begin{bmatrix}
\dfrac{\partial y}{x_1} \\
\dfrac{\partial y}{x_2} \\
\vdots \\
\dfrac{\partial y}{x_N}
\end{bmatrix}
\end{align}
\end{document}
% create a list of cited and uncited refereces with biblatex
\documentclass[12pt]{article}
% biblatex
\usepackage[backend=bibtex, sorting=none, style=numeric-comp, defernumbers=true]{biblatex} % using biblatex
\addbibresource{refs.bib} % add reference file
% for each cited reference create a category named "cited"
\DeclareBibliographyCategory{cited}
\AtEveryCitekey{\addtocategory{cited}{\thefield{entrykey}}}
\begin{document}
Text
\nocite{*}
\printbibheading
\printbibliography[category=cited,heading=subbibliography,title={Cited papers}]
\printbibliography[title={Supplementary papers},heading=subbibliography,notcategory=cited]
\end{document}
% make PDF with a customized PDF dimension, this second page has PDF page with another customized dimension
\documentclass{article}
\usepackage[margin=2mm,textwidth=155mm,paperheight=20cm,paperwidth=15cm]{geometry}
\begin{document}
This is a standard page.
\clearpage
\edef\hmm{\pdfpagewidth=\the\pdfpagewidth \pdfpageheight=\the\pdfpageheight\relax}
\pdfpagewidth=17in
\pdfpageheight=11in
\newgeometry{top=1in,left=1in,textwidth=15in,textheight=9in}
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page.
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page.
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page.
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page.
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page.
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page.
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page.
\vspace*{\fill}
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page.
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page.
\restoregeometry
\hmm
Back to a standard page
\end{document}
\documentclass{article}
\input{default_preamble.tex}
\input{default_glossary_entries.tex}
\title{My incredible title}
\author[1]{Awesome Author 1}
\author[2]{Awesome Author 2}
\author[2]{Awesome Author 3}
\affil[1]{Amazing University 1}
\affil[2]{Amazing University 2}
\date{\today}
\makeglossaries
\begin{document}
\maketitle
Hello world \cite{strangIntroductionLinearAlgebra1993}!
\begin{itemize}
\item First time \(\rightarrow\) \cgls{ar}. Second time \(\rightarrow\) \cgls{ar};
\item 2\textordmasculine time (in plural with the ``firstplural'' entry) \(\rightarrow\) \cglspl{ismr}. Second time \(\rightarrow\) \cgls{ismr};
\item Hyphenated entry (with the ``hyphenated'' entry) \(\rightarrow\) \cglshyph{sota} methods. Second time \(\rightarrow\) \cgls{sota} methods.
\end{itemize}
\printbibliography
\printglossaries % to print the glossary, add `automake` as the fist option in the `glossaries-extra` pkg import (see the `default_preamble.tex` file)
\end{document}
\documentclass{article}
\usepackage{subcaption}
\usepackage[demo]{graphicx} % omit 'demo' for real document
\begin{document}
\begin{figure}
\begin{subfigure}{0.31\textwidth}
\includegraphics[width=\linewidth]{fig_a.pdf}
\caption{First subfigure} \label{fig:1a}
\end{subfigure}%
\hspace*{\fill} % maximize separation between the subfigures
\begin{subfigure}{0.31\textwidth}
\includegraphics[width=\linewidth]{fig_b.pdf}
\caption{Second subfigure} \label{fig:1b}
\end{subfigure}%
\hspace*{\fill} % maximizeseparation between the subfigures
\begin{subfigure}{0.31\textwidth}
\includegraphics[width=\linewidth]{fig_c.pdf}
\caption{Third subfigure} \label{fig:1c}
\end{subfigure}
\caption{A figure that contains three subfigures} \label{fig:1}
\end{figure}
\end{document}
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{float} % to use [H]
\usepackage[skip=0.5ex]{subcaption}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{figure}[H]
\centering
\begin{subfigure}{0.6\textwidth}
\includegraphics[width=\linewidth]{example-image}
\subcaption{$Q^{*}$ values for arm 1}
\label{subfig:item1}
\end{subfigure}
\end{figure}
\begin{figure}[H]\ContinuedFloat
\centering
\begin{subfigure}{0.6\textwidth}
\includegraphics[width=\linewidth]{example-image}
\subcaption{$Q^{*}$ values for arm 2}
\label{subfig:item2}
\end{subfigure}
\caption{$Q^{*}$ values for different arms}
\end{figure}%
\begin{figure}[H]\ContinuedFloat
\centering
\begin{subfigure}{0.6\textwidth}
\includegraphics[width=\linewidth]{example-image}
\subcaption{$Q^{*}$ values for arm 3}
\label{subfig:item3}
\end{subfigure}
\end{figure}
\begin{figure}[H]\ContinuedFloat
\centering
\begin{subfigure}{0.6\textwidth}
\includegraphics[width=\linewidth]{example-image}
\subcaption{$Q^{*}$ values for arm 4}
\label{subfig:item4}
\end{subfigure}
\caption[]{$Q^{*}$ values for different arms (cont.)}
\label{fig:main-label}
\end{figure}
\lipsum[2-3]
\end{document}
\newcounter{prob}
\newcounter{subprob}
\renewcommand{\thesubprob}{\alph{subprob}}
\newcommand{\problem}{\setcounter{subprob}{0} \stepcounter{prob} \par \medskip \noindent \textbf{Problem~\theprob \ }}
\newcommand{\answer}{\par \medskip \noindent \textit{Answer \ }}
\newcommand{\finalanswer}[1]{
\begin{center}
{\renewcommand{\arraystretch}{1.5}
\renewcommand{\tabcolsep}{0.2cm}
\begin{tabular}{|c|}
\hline
$ \displaystyle #1 $ \\
\hline
\end{tabular}}
\end{center}}
\newcommand{\subproblem}{\stepcounter{subprob} \par \smallskip \noindent \quad \textit{(\thesubprob) \ }}
\newcommand{\subanswer}{\par \smallskip \noindent \quad \textit{Answer \ }}
\newcommand{\option}{\item[$\square$]}
\newcommand{\thisone}{\item[$\blacksquare$]}
\newenvironment{subitemize}{\begin{itemize}}{\end{itemize}}
\documentclass[12pt,a4paper]{article}
\input{default_preamble.tex}
\input{homework_commands.tex}
\begin{document}
\author{Student}
\title{Document name}
\date{\today}
\maketitle
%%--CABEÇALHO--%%
\begin{center}
{\huge Title \par}
{\LARGE Discipline \par}
{\Large Course \par}
{\Large Professors \par}
% {\Large Opitional}
\end{center}
\problem \label{probone}
Problem
\subproblem Item
\subproblem Item
\subproblem Item
\answer
%============================================
\end{document}
% how to use IEEEeqnarray to write equations with complex break lines.
% in this example, one breaks lines within the () and || delimiters
% it uses \IEEEeqnarraymulticol
% NOTE: basic
\begin{IEEEeqnarray}{lCr}
y&=&xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\\
&& {}+gggggggggggggggggggggg
\end{IEEEeqnarray}
\begin{IEEEeqnarray}{rsrll}
y_{e} \left[ k \right]
& = & \left|\vphantom{\frac{1}{N} \left( \gamma_s \left[ k \right] g \left[ k \right] \mathbf{c} \left[ k; \tau\left[ k \right] \right] \odot \mathbf{d} \left[ k; f_d \left[ k \right] \right] e^{j \phi_s \left[ k \right]} + \boldsymbol{\etaup} \left[ k \right] \right)^\mathsf{H} \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right)}\right.
& \left. \frac{1}{N} \left( \gamma_s \left[ k \right] g \left[ k \right] \mathbf{c} \left[ k; \tau\left[ k \right] \right] \odot \mathbf{d} \left[ k; f_d \left[ k \right] \right] e^{j \phi_s \left[ k \right]} + \boldsymbol{\etaup} \left[ k \right] \right)^\mathsf{H} \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right)\right|^{2} \nonumber \\
%
& = & \left|\vphantom{\frac{1}{N} \gamma_s \left[ k \right] g \left[ k \right] e^{- j \phi_s \left[ k \right]} \left(\mathbf{c} \left[ k; \tau\left[ k \right] \right] \odot \mathbf{d} \left[ k; f_d \left[ k \right] \right] \right)^\mathsf{H} \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right)}\right.
& \frac{1}{N} \gamma_s \left[ k \right] g \left[ k \right] e^{- j \phi_s \left[ k \right]} \left(\mathbf{c} \left[ k; \tau\left[ k \right] \right] \odot \mathbf{d} \left[ k; f_d \left[ k \right] \right] \right)^\mathsf{H} \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right) \nonumber \\
&&& \left. {}+ \frac{1}{N} \boldsymbol{\etaup}^\mathsf{H} \left[ k \right] \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right)\right|^{2} \nonumber \\
& = & \left(\vphantom{
\left( \frac{1}{N} \gamma_s \left[ k \right] g \left[ k \right] e^{- j \phi_s \left[ k \right]} \left(\mathbf{c} \left[ k; \tau\left[ k \right] \right] \odot \mathbf{d} \left[ k; f_d \left[ k \right] \right] \right)^\mathsf{H} \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right) + \frac{1}{N} \boldsymbol{\etaup}^\mathsf{H} \left[ k \right] \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right) \right)
}\right.
& \frac{1}{N} \gamma_s \left[ k \right] g \left[ k \right] e^{- j \phi_s \left[ k \right]} \left(\mathbf{c} \left[ k; \tau\left[ k \right] \right] \odot \mathbf{d} \left[ k; f_d \left[ k \right] \right] \right)^\mathsf{H} \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right) \nonumber \\
&&& \left. {}+ \frac{1}{N} \boldsymbol{\etaup}^\mathsf{H} \left[ k \right] \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right) \right) \nonumber \\
&& \left(\vphantom{
\left( \frac{1}{N} \gamma_s \left[ k \right] g \left[ k \right] e^{- j \phi_s \left[ k \right]} \left(\mathbf{c} \left[ k; \tau\left[ k \right] \right] \odot \mathbf{d} \left[ k; f_d \left[ k \right] \right] \right)^\mathsf{H} \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right) + \frac{1}{N} \boldsymbol{\etaup}^\mathsf{H} \left[ k \right] \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right) \right)
}\right.
& \frac{1}{N} \gamma_s \left[ k \right] g \left[ k \right] e^{- j \phi_s \left[ k \right]} \left(\mathbf{c} \left[ k; \tau\left[ k \right] \right] \odot \mathbf{d} \left[ k; f_d \left[ k \right] \right] \right)^\mathsf{H} \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right) \nonumber \\
&&& \left. {}+ \frac{1}{N} \boldsymbol{\etaup}^\mathsf{H} \left[ k \right] \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right) \right)^*
\end{IEEEeqnarray}
\begin{IEEEeqnarray}{rcll}
y_e \left[ k \right] = & \left(\vphantom{\frac{1}{N}} \right. & N \gamma_s \left[ k \right] g \left[ k \right] e^{- j \phi_s \left[ k \right]} R_\mathbf{c} \left( \varepsilon_{\tau} \left[ k \right] - \Delta \right) R_{\mathbf{d},\tilde{\mathbf{c}}} \left( f_d \left[ k \right], \varepsilon_{\tau} \left[ k \right] - \Delta \right) \nonumber \\
&& {}+ \left.\frac{1}{N} \boldsymbol{\etaup}_e^\mathsf{H} \left[ k \right] \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right) \right) \nonumber \\
& \left(\vphantom{\frac{1}{N}} \right. & N \gamma_s \left[ k \right] g \left[ k \right] e^{j \phi_s \left[ k \right]} R_\mathbf{c} \left( \varepsilon_{\tau} \left[ k \right] - \Delta \right) R_{\mathbf{d},\tilde{\mathbf{c}}}^{*} \left( f_d \left[ k \right], \varepsilon_{\tau} \left[ k \right] - \Delta \right) \nonumber \\
&& {}+ \left.\frac{1}{N} \boldsymbol{\etaup}_e^\top \left[ k \right] \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right) \right) \nonumber \\
= & \IEEEeqnarraymulticol{2}{l}{N^{2} \gamma_s^2 \left[ k \right] R_\mathbf{c}^{2} \left( \varepsilon_{\tau} \left[ k \right] - \Delta \right) \abs{R_{\mathbf{d},\tilde{\mathbf{c}}} \left( f_d \left[ k \right], \varepsilon_{\tau} \left[ k \right] - \Delta \right)}^{2}} \nonumber \\
& \IEEEeqnarraymulticol{2}{l}{{}+ \gamma_s \left[ k \right] g \left[ k \right] e^{- j \phi_s \left[ k \right]} R_\mathbf{c} \left( \varepsilon_{\tau} \left[ k \right] - \Delta \right) R_{\mathbf{d},\tilde{\mathbf{c}}} \left( f_d \left[ k \right], \varepsilon_{\tau} \left[ k \right] - \Delta \right) \boldsymbol{\etaup}_e^\top \left[ k \right] \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right)} \nonumber \\
& \IEEEeqnarraymulticol{2}{l}{{}+ \gamma_s \left[ k \right] g \left[ k \right] e^{j \phi_s \left[ k \right]} R_\mathbf{c} \left( \varepsilon_{\tau} \left[ k \right] - \Delta \right) R_{\mathbf{d},\tilde{\mathbf{c}}}^{*} \left( f_d \left[ k \right], \varepsilon_{\tau} \left[ k \right] - \Delta \right) \boldsymbol{\etaup}_e^\mathsf{H} \left[ k \right] \mathbf{c} \left( \hat{\tau} \left[ k \right] + \Delta \right)} \nonumber \\
& \IEEEeqnarraymulticol{2}{l}{{}+ \frac{1}{N} \abs{\boldsymbol{\etaup}_e \left[ k \right]}^{2},}
\end{IEEEeqnarray}
maxNumberOfBackUps: 0
lookForAlignDelims:
xltabular: 1
# you must run this Makefile using the zsh interpreter
SHELL := /usr/bin/zsh
# you should change the main LaTeX basename if it is not "main.tex". Don't include the ".tex" entension.
BASENAME=main
# pdflatex, xelatex, lualatex, latexmk
LATEX_ENGINE=pdflatex
# LaTeX flags
LATEX_FLAGS=--shell-escape -synctex=1 -interaction=nonstopmode -file-line-error
# bibtex biber
BIB_PROCESSOR=biber
.PHONY: all compile clean format
# Make considers targets that correspond to filenames to be up-to-date if the file exists and its modification time is later than that of its prerequisites. However, sometimes you may want to define targets that do not correspond to actual files, but rather perform some action such as cleaning up a build directory or running tests. These are called "phony" targets.
# The reason why the command expansion $(command) is not working in your Makefile is because it is not being evaluated by the shell, but by Make itself. In Make, the $ character has a special meaning and is used to reference variables, so when you write $(command) in your Makefile, Make thinks you are trying to reference a variable called command and not running the command command. double dollar sign ($$) forces shell to run this command, $(shell command) also works
# By default, the shell interpreter used by a Makefile is /bin/sh. However, you can change the shell interpreter that must run the Makefile by setting the SHELL variable at the beginning of the Makefile. When you use := to define a variable with a shell command, like MY_VAR := $(shell date), the command is evaluated immediately and the result is stored as a simple string. The value of the variable is not re-evaluated every time it is used in a command. That is, it is evaluated only once.
# the "-" operator to ignore the exit status of the command and let the rule. When you have a conditional statement without an else and it return false (1 or more), it is not handled by the shell and is returned to the Makefile, which in turn stop the procedure. the "-" at the beginning of the command make Makefile ignore it
all: compile
# check whether it exists, but do not trigger it. If it doesn't exist, however, it is triggered.
compile: | default_preamble.tex
@echo "Compiling..."
@-[[ -f $(BASENAME).tex ]] && ! command grep -Eq '\\input\{default_preamble(\.tex)?\}' $(BASENAME).tex && sed -i '2i\\\input{default_preamble.tex}' $(BASENAME).tex
$(LATEX_ENGINE) $(LATEX_FLAGS) $(BASENAME).tex
$(BIB_PROCESSOR) $(BASENAME)
@-[[ -f default_glossary_entries.tex ]] && makeglossaries $(BASENAME)
# If you leave these two line commented, you need to build it twice every time you change a \cite entry. On the other hand, it gets faster
# $(LATEX_ENGINE) $(LATEX_FLAGS) $(BASENAME).tex
# $(LATEX_ENGINE) $(LATEX_FLAGS) $(BASENAME).tex
@echo "Process completed successfully!"
default_preamble.tex:
@wget -qO $@ https://gist.githubusercontent.com/tapyu/886dc95fc19c4250fb38581ccc58bed8/raw/_default_preamble.tex # The macro @ evaluates to the name of the current target
@echo "default_preamble.tex has been downloaded"
clean:
@echo -n "cleaning auxiliary files...\n"
@setopt +o nomatch; rm -f *.out *.aux *.alg *.acr *.dvi *.gls *.log *.bbl *.blg *.ntn *.not *.lof *.lot *.toc *.loa *.lsg *.nlo *.nls *.ilg *.ind *.ist *.glg *.glo *.xdy *.acn *.idx *.loq *.bcf *.fdb_latexmk *.fls *.xml *.gz *~
@rm -f $(BASENAME).pdf
@echo "Process completed successfully!"
format:
@grep -oP "(?<=\\\\input{)[^}]+" main.tex | while read file; do \
latexindent --silent --overwrite --local=.latexindent.yaml $${file}; \
done
\documentclass[a4paper]{article}
\usepackage[margin=1.5in]{geometry} % For margin alignment
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{algorithm}
\usepackage{arevmath} % For math symbols
\usepackage[noend]{algpseudocode}
\title{Algorithm template}
\author{Roy}
\date{\today} % Today's date
\begin{document}
\maketitle
\section{Demo code}
\begin{algorithm}
\caption{Put your caption here}
\begin{algorithmic}[1]
\Procedure{Roy}{$a,b$} \Comment{This is a test}
\State System Initialization
\State Read the value
\If{$condition = True$}
\State Do this
\If{$Condition \geq 1$}
\State Do that
\ElsIf{$Condition \neq 5$}
\State Do another
\State Do that as well
\Else
\State Do otherwise
\EndIf
\EndIf
\While{$something \not= 0$} \Comment{put some comments here}
\State $var1 \leftarrow var2$ \Comment{another comment}
\State $var3 \leftarrow var4$
\EndWhile \label{roy's loop}
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}
\documentclass{article}
\usepackage{xcolor}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\title{Another algorithm template}
\author{Roy}
%%% Coloring the comment as blue
\newcommand\mycommfont[1]{\footnotesize\ttfamily\textcolor{blue}{#1}}
\SetCommentSty{mycommfont}
\SetKwInput{KwInput}{Input} % Set the Input
\SetKwInput{KwOutput}{Output} % set the Output
\SetKwRepeat{Do}{do}{while}%
\begin{document}
\maketitle
\begin{algorithm}[H]
\DontPrintSemicolon
\KwInput{Your Input}
\KwOutput{Your output}
\KwData{Testing set $x$ \tcp{this is a comment}}
$\sum_{i=1}^{\infty} := 0$ \tcp*{this is another comment}
\tcc{Now this is an if...else conditional loop}
\If{Condition 1}
{
Do something \tcp*{this is another comment}
\If{sub-Condition}
{Do a lot}
\For(\tcp*[h]{A comment at left}){sequence}
{
loop instructions
}
}
\ElseIf{Condition 2}
{
Do Otherwise \;
\tcp{Now this is a for loop}
\For(\tcp*[f]{A comment at right}){sequence}
{
loop instructions
}
}
\Else
{
Do the rest
}
\tcc{Now this is a While loop}
\While{Condition}
{
Do something\;
}
\caption{Example code}
\label{alg:this-algorithm}
\end{algorithm}
\end{document}
\begin{algorithm}[H]
\SetKwInput{KwInput}{Input} % Set the Input
\SetKwInput{KwOutput}{Output} % set the Output
\DontPrintSemicolon
\KwInput{Your Input}
\KwOutput{Your output}
\KwData{Testing set $x$}
% Set Function Names
\SetKwFunction{FMain}{Main}
\SetKwFunction{FSum}{Sum}
\SetKwFunction{FSub}{Sub}
% Write Function with word ``Function''
\SetKwProg{Fn}{Function}{:}{}
\Fn{\FSum{$first$, $second$}}{
a = first\;
b = second\;
sum = first + second\;
\KwRet sum\;
}
\;
% Write Function with word ``Def''
\SetKwProg{Fn}{Def}{:}{}
\Fn{\FSub{$first$, $second$}}{
a = first\;
b = second\;
sum = first - second\;
\KwRet sum\;
}
\;
\SetKwProg{Fn}{Function}{:}{\KwRet}
\Fn{\FMain}{
a = 5\;
b = 10\;
Sum(5, 10)\;
Sub(5, 10)\;
print Sum, Sub\;
\KwRet 0\;
}
\end{algorithm}
% you should have ./test-png/test-{0..24}.png
\documentclass{article}
\usepackage{graphicx}
\usepackage{animate}
\begin{document}
Here is an animated GIF:
% fps
\animategraphics[loop,controls,width=\linewidth]{10}{test-png/test-}{0}{24}
\end{document}
\documentclass{article}
% create Bibliografy.bib
\usepackage{filecontents}
\begin{filecontents*}{Bibliografy.bib}
@book{strangIntroductionLinearAlgebra1993,
title = {Introduction to Linear Algebra},
author = {Strang, Gilbert and Strang, Gilbert and Strang, Gilbert and Strang, Gilbert},
date = {1993},
volume = {3},
publisher = {Wellesley-Cambridge Press Wellesley, MA}
}
@inproceedings{fohlmeisterDualKalmanFiltering2018,
title = {Dual {{Kalman}} Filtering Based {{GNSS}} Phase Tracking for Scintillation Mitigation},
booktitle = {2018 {{IEEE}}/{{ION Position}}, {{Location}} and {{Navigation Symposium}} ({{PLANS}})},
author = {Fohlmeister, Friederike and Antreich, Felix and Nossek, Josef A.},
date = {2018-04},
pages = {1151--1158},
issn = {2153-3598},
doi = {10.1109/PLANS.2018.8373499},
eventtitle = {2018 {{IEEE}}/{{ION Position}}, {{Location}} and {{Navigation Symposium}} ({{PLANS}})},
keywords = {GNSS,Synchronization}
}
@article{rinoAngleDependenceSingly1977,
title = {The Angle Dependence of Singly Scattered Wavefields},
author = {Rino, CL and Fremouw, EJ},
date = {1977},
journaltitle = {Journal of Atmospheric and Terrestrial Physics},
shortjournal = {Journal of Atmospheric and Terrestrial Physics},
volume = {39},
number = {8},
pages = {859--868},
publisher = {Elsevier},
issn = {0021-9169}
}
\end{filecontents*}
% Use the biblatex package
\usepackage[style=authoryear, backend=biber, hyperref=true]{biblatex}
\addbibresource{Bibliografy.bib}
\usepackage[hidelinks,allcolors=blue]{hyperref}
\hypersetup{
colorlinks = true, %Colours links instead of ugly boxes
urlcolor = blue, %Colour for external hyperlinks
linkcolor = blue, %Colour of internal links
citecolor = red %Colour of citations
}
\title{My incredible title}
\date{\today}
\begin{document}
\maketitle
Hello world!
\begin{itemize}
\item A normal citation: \cite{strangIntroductionLinearAlgebra1993}.
\item A parenthesis citation: \parencite{fohlmeisterDualKalmanFiltering2018}.
\item A textual citation: \textcite{rinoAngleDependenceSingly1977}.
\item Citing only the author's name: \citeauthor{strangIntroductionLinearAlgebra1993}.
\item Citing only the year of publication: \citeyear{strangIntroductionLinearAlgebra1993}.
\item Citing only the title of the source: \citetitle{rinoAngleDependenceSingly1977}.
\end{itemize}
\printbibliography
\end{document}
\documentclass{article}
\usepackage{fontspec}
% \usepackage{unicode-math}
% \usepackage[utf8]{inputenc}
\usepackage{minted}
% \newfontfamily \JuliaMono {JuliaMono-Regular.ttf}[
% Path = /home/tapyu/.local/share/fonts/juliamono/,
% Extension = .ttf
% ]
% \newfontface \JuliaMonoRegular{JuliaMono-Regular}
% \setmonofont{JuliaMonoRegular}[
% Contextuals=Alternate
% ]
\begin{document}
This is some text with an \mintinline{python}{if} statement in it. You can also include variable names like \mintinline{cpp}{int x = 42;}. Now it is Matlab \mintinline{matlab}{fft(x)}.
\begin{minted}[breaklines,escapeinside=||,mathescape=true, linenos, numbersep=3pt, gobble=2, frame=lines, fontsize=\small, framesep=2mm]{julia}
using Convex, SCS, Plots, LaTeXStrings
N = 30 # N in the set {0, 1, ..., N}
n = 3 # order of the linear dynamical system
x_des = [7, 2, -6] # constraint -> ��(N) == x_des
# model parameters
�� = [-1 .4 .8; 1 0 0; 0 1 0]
�� = [1, 0, 0.3]
�� = Variable(n, N+1) # [��(0) ��(1) ... ��(N)]
�� = Variable(1, N) # [u(0) u(1) ... u(N-1)]
f0 = sum(max(abs(��), 2abs(��)-1)) # objective function
constraints = [
��[:,2:N+1] == ��*��[:,1:N]+��*��, # recursive equation
��[:,1] == zeros(n), # initial condition
��[:,N+1] == x_des, # final condition
]
problem = minimize(f0, constraints)
solve!(problem, SCS.Optimizer; silent_solver = true)
fig = plot(vec(��.value), xlabel=L"k", title=L"u(k)", line=:steppre)
savefig(fig, "figs/4.17.png")
\end{minted}
\end{document}
\usepackage{float}
\begin{figure}[H]
\centering
\includegraphics[scale=0.35]{../figs/elementwise_OLS/residues_PDF_I5i1.png}
\caption{Distribution of the residuals.}
\label{fig:distribution}
\end{figure}
% arara: pdflatex
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
% SEE: https://tex.stackexchange.com/a/230664/211183
\documentclass{article}
\usepackage[xindy,style=long,numberline,savewrites=true,acronym,nomain]{glossaries}
\makeglossaries
\glsenableentrycount % enable \cgls, \cglspl, \cGls, \cGlspl
\input{glossaries_entries.tex}
\begin{document}
\printglossaries
\begin{itemize}
\item Multiple use: \cgls{cnn}, \cgls{cnn}, \cgls{cnn}.
\item Multiple use: \cgls{dl}, \cgls{dl}.
\item One-time use: \cgls{sota}.
%\item The first use is in \glspl{ismr} and subsequent uses are \gls{ismr}. But if I want, I can use long form \glsxtrlong{ismr}. % ???
\end{itemize}
\end{document}
\documentclass{article}
\usepackage{amsmath,amsfonts}
\begin{document}
\begin{align}
\mathbf{A} = \begin{bmatrix}
a_{11} & a_{12} & \dots & a_{1n} \\
a_{21} & a_{22} & \dots & a_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m1} & a_{m2} & \dots & a_{mn} \\
\end{bmatrix} \in \mathbb{C}^{m \times n}
\end{align}
\end{document}
\documentclass{article}
\usepackage{iftex}
\ifLuaTeX
\usepackage{luacolor}
\usepackage[soul]{lua-ul}
\else
\usepackage{soul}
\fi
\usepackage[normalem]{ulem}
\makeatletter
\@ifundefined{st}{\newcommand{\st}[1]{\sout{#1}}}{\renewcommand{\st}[1]{\sout{#1}}}
\makeatother
\DeclareRobustCommand{\remove}[1]{\textcolor{red}{\st{#1}}}
\DeclareRobustCommand{\add}[1]{\textcolor{magenta}{#1}}
\DeclareRobustCommand{\change}[2]{\textcolor{red}{\st{#1}}\,\textcolor{magenta}{#2}}%
\newcommand{\remove}[1]{\hl{\color{red}\st{#1}}}
\newcommand{\add}[1]{\hl{\color{blue}#1}}
\newcommand{\change}[2]{\hl{\color{red}\st{#1}}\hl{\color{blue}#2}}
\begin{document}
\add{aaa} \remove{bbb} \change{ccc}{ddd}
\end{document}
\usepackage{svg}
\begin{figure}[H]
\centering
\includesvg[scale=0.35]{../figs/violin.svg}
\caption{Box plot of the rainfall estimation.}
\label{fig:distribution}
\end{figure}
\documentclass{article}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Example Table}
\begin{tabular}{|c|c|c|}
\hline
\textbf{Column 1} & \textbf{Column 2} & \textbf{Column 3} \\
\hline
Row 1, Col 1 & Row 1, Col 2 & Row 1, Col 3 \\
Row 2, Col 1 & Row 2, Col 2 & Row 2, Col 3 \\
Row 3, Col 1 & Row 3, Col 2 & Row 3, Col 3 \\
\hline
\end{tabular}
\label{tab:example}
\end{table}
\end{document}
\documentclass{article}
% redefine \maketitle
\makeatletter % changes the catcode of @ to 11
\def\@maketitle{%
\newpage
\null
\vskip 2em%
\begin{center}%
\let \footnote \thanks
{\LARGE \@title \par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\@author\\
\end{tabular}\par}%
\vskip 1em%
{\large {\tt Version:}\@date}%
\end{center}%
\par
\vskip 1.5em}
\makeatother % changes the catcode of @ back to 12
\usepackage{authblk}
\begin{document}
\title{\textbf{Notation} \vspace{-.3cm}}
\author{Rubem Vasconcelos Pacelli\\
{\tt rubem.engenharia@gmail.com}}
\affil{Department of Teleinformatics Engineering,\\Federal University of Ceará.\\Fortaleza, Ceará, Brazil. \vspace{-.5cm}}
\maketitle
\end{document}
\documentclass{article}
% CAVEAT: It doesn't work for two-column layout!
\usepackage{xltabular}
\newcolumntype{A}{>{\hsize=.5\hsize}X}
\newcolumntype{B}{>{\hsize=.25\hsize\centering\arraybackslash}X}
\newcolumntype{C}{>{\hsize=.25\hsize}X}
\begin{document}
\begin{xltabular}[l]{\linewidth}{|A|B|C|}
\caption{Caption.\label{tab:xltabular}}\\[\belowcaptionskip]\hline
Alpha & Beta & Gamma \\ \hline
0 & 2 & 4 \\ \hline
1 & 3 & 5 \\ \hline
\end{xltabular}
\end{document}
\documentclass{article}
\usepackage[showframe=true]{geometry}
\usepackage{enumitem}
\begin{document}
\begin{itemize}[leftmargin=*]
\item one
\item two
\item three
\end{itemize}
\end{document}
\documentclass{article}
\begin{filecontents*}[overwrite]{tasks.csv}
task,obj,resources,wp
task1.1,1,2k,1
task2.1,2,3k,2
task3.1,3,4k,3
\end{filecontents*}
\usepackage{datatool}
\begin{document}
% Load the database; later referenced as tasks
\DTLloaddb
[keys={task,obj,resources,wp}]% <options>
{tasks}% <db name>
{tasks.csv}% <filename>
Resources for the first task from Work Package
\DTLfetch{tasks}{task}{task2.1}{resources} %\input{project.csv[task1.1, wp]}
are
\DTLfetch{tasks}{task}{task1.1}{resources} %\input{project.csv[task1.1, resources]}
USD.
\end{document}
% text colors
\documentclass{article}
\usepackage{xcolor}
\newcommand{\obs}[1]{\textcolor{red}{#1}}
\begin{document}
This is an \obs{observation!}.
\end{document}
\pagenumbering{gobble}
% make underbraces with multiple lines
\usepackage{amsmath}
\[
\underbrace{...}_{\substack{\text{Some long text that} \\ \text{should be multiline}}}
\]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment