latex - animeshtrivedi/notes GitHub Wiki

When git pull goes wrong

atr@atr-xps-13:~/vu/github/animeshtrivedi/papers/2024-paper-zns-tools-CHEOPS$ git commit -am "formatting issues, annon fixed" 
[main 101eb77] formatting issues, annon fixed
 4 files changed, 729 insertions(+), 200 deletions(-)
 create mode 100644 2024-cheops-CR.tex
 rewrite ccsxml.tex (100%)
 rewrite main.tex (71%)
 rewrite sections/0-abstract.tex (99%)
atr@atr-xps-13:~/vu/github/animeshtrivedi/papers/2024-paper-zns-tools-CHEOPS$ git push origin main 
To github.com:Krien/2024-paper-zns-tools-CHEOPS.git
 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to '[email protected]:Krien/2024-paper-zns-tools-CHEOPS.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
atr@atr-xps-13:~/vu/github/animeshtrivedi/papers/2024-paper-zns-tools-CHEOPS$ git pull origin main 
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 17 (delta 10), reused 14 (delta 7), pack-reused 0
Unpacking objects: 100% (17/17), 622.03 KiB | 1.50 MiB/s, done.
From github.com:Krien/2024-paper-zns-tools-CHEOPS
 * branch            main       -> FETCH_HEAD
   6c33bff..0d38e5f  main       -> origin/main
Auto-merging sections/0-abstract.tex
CONFLICT (content): Merge conflict in sections/0-abstract.tex
Auto-merging main.tex
CONFLICT (content): Merge conflict in main.tex
Automatic merge failed; fix conflicts and then commit the result.

Just abort the local merge.

git merge --abort

https://stackoverflow.com/questions/1223354/undo-git-pull-how-to-bring-repos-to-old-state

Setting up ORCID IEEE (does not work with ACM)

\documentclass{IEEEtran}
\usepackage{scalerel}
\usepackage{tikz}
\usetikzlibrary{svg.path}

\definecolor{orcidlogocol}{HTML}{A6CE39}
\tikzset{
  orcidlogo/.pic={
    \fill[orcidlogocol] svg{M256,128c0,70.7-57.3,128-128,128C57.3,256,0,198.7,0,128C0,57.3,57.3,0,128,0C198.7,0,256,57.3,256,128z};
    \fill[white] svg{M86.3,186.2H70.9V79.1h15.4v48.4V186.2z}
                 svg{M108.9,79.1h41.6c39.6,0,57,28.3,57,53.6c0,27.5-21.5,53.6-56.8,53.6h-41.8V79.1z M124.3,172.4h24.5c34.9,0,42.9-26.5,42.9-39.7c0-21.5-13.7-39.7-43.7-39.7h-23.7V172.4z}
                 svg{M88.7,56.8c0,5.5-4.5,10.1-10.1,10.1c-5.6,0-10.1-4.6-10.1-10.1c0-5.6,4.5-10.1,10.1-10.1C84.2,46.7,88.7,51.3,88.7,56.8z};
  }
}

\newcommand\orcidicon[1]{\href{https://orcid.org/#1}{\mbox{\scalerel*{
\begin{tikzpicture}[yscale=-1,transform shape]
\pic{orcidlogo};
\end{tikzpicture}
}{|}}}}

\usepackage{hyperref} %<--- Load after everything else

\begin{document}

\title{Title goes here}
\author{John Doe \orcidicon{0000-0000-0000-0000}\,, \IEEEmembership{Senior Member, IEEE}}
\maketitle

\end{document}

How to make double line to \cline

\begin{table}[t!]
    \small
    \centering
    \caption{xxx}
    \label{table:label}
    \begin{tabular}{cr||r|r|r|r|r}
    %\hline
    \multicolumn{7}{c}{\textbf{W lat}} \\    
    \cline{2-7}        
    \multirow{7}{*}{\rotatebox{90}{\textbf{R lat}}} & & 0\,s & 100\,$\mu$s & 10\,ms & 20\,ms & 100\,ms \\    
    \cline{2-7}
    \noalign{\vskip\doublerulesep
         \vskip-\arrayrulewidth} \cline{2-7}
        &0\,s        & \hlxG{2.8 (128)} & 2.7 (119) & 1.4 (10) &  \hlx{1.4 (1)}    &  \hlx{1.6 (1)}   \\ 
        &50\,$\mu$s  & \hlxG{2.8 (128)} & 2.7 (119) &  1.5 (17) &  \hlx{1.7 (1)}    &  \hlx{1.6 (1)}   \\ 
        &100\,$\mu$s & \hlxG{2.8 (128)} & 2.8 (116) &  1.7 (39) &  \hlx{1.6 (1)}    &  \hlx{1.5 (1)}   \\ 
        &500\,$\mu$s & \hlxG{2.8 (128)} & 2.7 (118) &  1.9 (50) &  \hlx{1.5 (1)}    &  \hlx{1.5 (1)}   \\ 
        &10\,ms      & \hlxG{2.8 (128)} & \hlxG{2.8 (128)} & \hlxG{2.8 (128)} & \hlxG{2.8 (128)} & \hlxG{2.8 (128)} \\ 
        &100\,ms     & \hlxG{2.8 (128)} & \hlxG{2.8 (128)} & \hlxG{2.8 (128)} & \hlxG{2.8 (128)} & \hlxG{2.8 (128)} \\
    \cline{2-7}
    \end{tabular}
\end{table}

Otherwise

\documentclass{article}
\usepackage{hhline}
\begin{document}

\begin{tabular}{|c|c|c|}
\hline 
1 & 2 & 3 \\ \hhline{|=|=|=|}
4 & 5 & 6 \\ \hline
7 & 8 & 9 \\ \hline
\end{tabular}

\end{document}

https://tex.stackexchange.com/questions/130818/how-to-draw-a-double-hline-in-a-table-without-interrupting-vertical-lines

https://latex-tutorial.com/tables-in-latex/

Colors in Latex: https://www.overleaf.com/learn/latex/Using_colors_in_LaTeX

Background highlight without spacing

https://www.latex4technics.com/?note=2mwg

\usepackage{xcolor}

\newcommand{\reducedstrut}{\vrule width 0pt height .9\ht\strutbox depth .9\dp\strutbox\relax}
%\newcommand{\hlx}[1]{#1}
%\newcommand{\hlx}[1]{\fboxsep{0pt}\colorbox{lime}{#1}}
\newcommand{\hlx}[1]{{\begingroup\fboxsep=0pt\colorbox{lime}{\reducedstrut #1}\endgroup}}

Counter example

https://www.overleaf.com/learn/latex/Counters

\newcounter{mycounter}
\setcounter{mycounter}{0}
\newcommand{\getQNum}{\stepcounter{mycounter} Q\themycounter{}}

## Then use \getQNum{} where ever you want increasing number of Q1, Q2, Q3... 

Font

\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge

SVG to PDF

$ sudo apt-get install librsvg2-bin
$ rsvg-convert -f pdf -o t.pdf t.svg

https://superuser.com/questions/381125/how-do-i-convert-an-svg-to-a-pdf-on-linux

Fake figure


\begin{figure}[t!]
\centering
%\begin{minipage}{0.85\textwidth}
  \centering
  \includegraphics[width=.9\linewidth]{example-image-a}  
  \captionof{figure}{Caption.}
  \label{fig:caption}  
%\end{minipage}
\end{figure}

Example: custom enumeration and numbers

\begin{enumerate}[label={\textbf{(A\arabic*)}},leftmargin=15pt,itemindent=1em]%,nolistsep]
  \setcounter{enumi}{3}  
\end{enumerate}

\begin{enumerate}[label={\textbf{(Q\arabic*)}}] 
  \item 
\end{enumerate}

Example: Table

\begin{table*}[h!]
\centering
\begin{tabular}{ c | p{0.2\linewidth} | p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth}}
 \toprule
 a & 2 & 3 & 4 & 5 \\ 
  \midrule  
 \bottomrule 
\end{tabular}
\caption{Table to test captions and labels.}
\label{table:1}
\end{table*}

Latex to docx

https://waterprogramming.wordpress.com/2018/08/26/converting-latex-to-ms-word-docx-almost-perfectly/

sudo apt-get install pandoc pandoc-citeproc. 

#To run Pandoc on a Latex document:
pandoc -s main.tex --bibliography=main.bib -o main.docx.

Upgrading texlive on ubuntu

https://fahim-sikder.github.io/post/installing-texlive-latest-ubuntu/

Remove the old ones:

sudo apt-get purge texlive*
sudo rm -rf /usr/local/texlive/*
rm -rf ~/.texlive*
sudo rm -rf /usr/local/share/texmf
sudo rm -rf /var/lib/texmf
sudo rm -rf /etc/texmf
sudo apt-get remove tex-common --purge
rm -rf ~/.texlive

Prep and download

sudo apt install wget perl-tk
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
cd install-tl-****
sudo ./install.pl

After this (in the blog is says 2021, but now it is 2022):

sudo vim ~/.bashrc

#add following
export PATH=/usr/local/texlive/2022/bin/x86_64-linux${PATH:+:${PATH}}
export INFOPATH=/usr/local/texlive/2022/texmf-dist/doc/info${INFOPATH:+:${INFOPATH}}
export MANPATH=/usr/local/texlive/2022/texmf-dist/doc/man${MANPATH:+:${MANPATH}}

Done, but now tell Ubuntu that we have installed

sudo apt install equivs --no-install-recommends freeglut3
wget -O debian-equivs-2022-ex.txt https://www.tug.org/texlive/files/debian-equivs-2022-ex.txt

#We are using the debian-equivs-2022-ex.txt file to build a .deb file to install the necessary packages.
equivs-build debian-equivs-2022-ex.txt
sudo dpkg -i texlive-local_2022.99999999-1_all.deb
sudo apt install -f

New ACM packages needs newer tex builds

Time used for installing the packages: 27:29
running mktexlsr /usr/local/texlive/2021/texmf-dist ...
mktexlsr: Updating /usr/local/texlive/2021/texmf-dist/ls-R... 
mktexlsr: Done.
writing fmtutil.cnf to /usr/local/texlive/2021/texmf-dist/web2c/fmtutil.cnf
writing updmap.cfg to /usr/local/texlive/2021/texmf-dist/web2c/updmap.cfg
writing language.dat to /usr/local/texlive/2021/texmf-var/tex/generic/config/language.dat
writing language.def to /usr/local/texlive/2021/texmf-var/tex/generic/config/language.def
writing language.dat.lua to /usr/local/texlive/2021/texmf-var/tex/generic/config/language.dat.lua
running mktexlsr /usr/local/texlive/2021/texmf-var /usr/local/texlive/2021/texmf-config /usr/local/texlive/2021/texmf-dist ...
mktexlsr: Updating /usr/local/texlive/2021/texmf-config/ls-R... 
mktexlsr: Updating /usr/local/texlive/2021/texmf-dist/ls-R... 
mktexlsr: Updating /usr/local/texlive/2021/texmf-var/ls-R... 
mktexlsr: Done.
running updmap-sys --nohash ...done
re-running mktexlsr /usr/local/texlive/2021/texmf-var /usr/local/texlive/2021/texmf-config ...
mktexlsr: Updating /usr/local/texlive/2021/texmf-config/ls-R... 
mktexlsr: Updating /usr/local/texlive/2021/texmf-var/ls-R... 
mktexlsr: Done.
setting up ConTeXt cache: running mtxrun --generate ...done
pre-generating all format files, be patient...
running fmtutil-sys --no-error-if-no-engine=luajithbtex,luajittex,mfluajit --no-strict --all ...done
running package-specific postactions
finished with package-specific postactions


Welcome to TeX Live!


See /usr/local/texlive/2021/index.html for links to documentation.
The TeX Live web site (https://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; please consider supporting it by joining the group best for you. The list of groups is available on the web at https://tug.org/usergroups.html.


Add /usr/local/texlive/2021/texmf-dist/doc/man to MANPATH.
Add /usr/local/texlive/2021/texmf-dist/doc/info to INFOPATH.
Most importantly, add /usr/local/texlive/2021/bin/x86_64-linux
to your PATH for current and future sessions.
Logfile: /usr/local/texlive/2021/install-tl.log
atr@atr-xps-13:~/src/install-tl-20220216$ 

Hyperlink boxes

https://tex.stackexchange.com/questions/823/remove-ugly-borders-around-clickable-cross-references-and-hyperlinks

font style

\renewcommand{\familydefault}{\sfdefault}

Table compression

\begin{table}[!t]
\setlength{\tabcolsep}{1pt}
\centering
\footnotesize %\small 
\begin{tabular}{ll}
\toprule
\bottomrule
\end{tabular}
\caption{\label{tab:???} ???}
\end{table}

Enum compression

\usepackage{enumitem}

\begin{itemize}[leftmargin=10pt,itemindent=0em,nolistsep]
\item 
\end{itemize}

Bib optimization

\let\OLDthebibliography\thebibliography
\renewcommand\thebibliography[1]{
  \OLDthebibliography{#1}
  \setlength{\parskip}{1.0pt}
  \setlength{\itemsep}{1.0pt plus 0.5ex}
  }

\bibliographystyle{abbrv}
{\footnotesize
\bibliography{main}}

Section sign

\usepackage{cleveref}
\crefformat{section}{\S#2#1#3} % see manual of cleveref, section 8.2.1
\crefformat{subsection}{\S#2#1#3}
\crefformat{subsubsection}{\S#2#1#3}

TODO


%\usepackage[inline,draft,nomargin,index]{fixme}

\documentclass{article}
\usepackage{xcolor}% provides \colorlet
\usepackage{fixme}
\fxsetup{
    status=draft,
    author=,
    layout=inline,
    theme=color
}

\definecolor{fxnote}{rgb}{0.8000,0.0000,0.0000}
% define the background colour:
\colorlet{fxnotebg}{yellow}

% refedine the layout macro:
\makeatletter
\renewcommand*\FXLayoutInline[3]{%
  \@fxdocolon {#3}{%
    \@fxuseface {inline}%
    \colorbox{fx#1bg}{\color {fx#1}\ignorespaces #3\@fxcolon #2}}}
\makeatother

\begin{document}

Some text \fxnote{other text} \fxnote*{blub}{blah}

\end{document}

Environment box

\newenvironment{boxed1}
    {\vspace{-1.4pt}
    \begin{center}
    \renewcommand{\arraystretch}{1}    
    \begin{tabular}{|p{0.45\textwidth}|}
    \hline
    }
    {
    \\\hline
    \end{tabular} 
    \end{center}    
    \vspace{-1.4pt}
    }

Hightlight

\hl{TODO}

### Packages 
```latex 
\usepackage{usenix2019_v3}
\usepackage{times,url,color,soul,xspace,enumitem}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{comment}
\usepackage{xspace}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage[inline,draft,nomargin,index]{fixme}

Checking embedded fonts

https://tex.stackexchange.com/questions/320000/check-which-fonts-are-embedded-in-the-final-pdf

https://tex.stackexchange.com/questions/10391/how-to-embed-fonts-at-compile-time-with-pdflatex

PDF compression

https://askubuntu.com/questions/113544/how-can-i-reduce-the-file-size-of-a-scanned-pdf-file

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
  • -dPDFSETTINGS=/screen lower quality, smaller size. (72 dpi)
  • -dPDFSETTINGS=/ebook for better quality, but slightly larger pdfs. (150 dpi)
  • -dPDFSETTINGS=/prepress output similar to Acrobat Distiller "Prepress Optimized" setting (300 dpi)
  • -dPDFSETTINGS=/printer selects output similar to the Acrobat Distiller "Print Optimized" setting (300 dpi)
  • -dPDFSETTINGS=/default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file