LaTeX
Basic usage of LaTeX.
todo
\usepackage[colorinlistoftodos]{todonotes}
\todo[inline, color=green!40]{This is an inline comment.}
enumitem
\usepackage{enumitem}
\maketitle
\begin{enumerate}[label=(\alph*)]
\item an apple
\item a banana
\end{enumerate}
verb
\verb|.bib|
href
\href{https://www.overleaf.com/blog/184}{Mendeley}
equiv
a\equiv b \bmod p
matrix
x^{(1)}=\begin{bmatrix}\frac{3}{2}\\[0.3em]\frac{9}{4}\end{bmatrix},
Just use overleaf here.
jumpnav-main
\documentclass[chi_draft]{sigchi}
\begin{document}
%\usepackage{natbib}
\title{}
\author{}
\maketitle
\input{abstract}
\input{intro}
\input{related}
\input{data}
\input{problem}
\input{observations}
\input{approach}
\input{exp}
\input{conclusion}
\bibliographystyle{SIGCHI-Reference-Format}
\bibliography{references}
\end{document}
convex optimization
\begin{alignat*}{2}
\min\quad & -2x_1-x_2+x_3 \\
\mbox{s.t.}\quad
&x_1+x_2+2x_3 \le 6 \\
&x_1+4x_2-x_3 \le 4 \\
&x_1, x_2, x_3 \ge 0
\end{alignat*}
MISC
\noindent
\textbf{}
\LaTeX{}
\TeX\
\TeX{}
\textbackslash
\textit{}
\empha{}
{\bf }
\smallskip
\bigskip
tikz
\begin{center}
\begin{tikzpicture}[domain=0:0.5,xscale=13,yscale=3.8]
\draw[<->] (0,2) node[left]{EUR}-- (0,0) -- (.7,0) node[below] {$q$};
\draw[red] plot (\x, {0.25+\x/2+\x*\x/2}) node[right] {$v_1(x)$};
\draw[green] plot (\x, {0.025+\x+\x*\x}) node[right] {$v_2(x)$};
\draw[thin, dashed] plot (\x, {0.275+1.5*\x+1.5*\x*\x}) ;
\draw[thick,domain=0:0.33666] plot (\x, {0.05+2*\x+2*\x*\x}) ;
\draw[thick,domain=0.33666:0.5]
plot (\x, {0.5+\x+\x*\x}) node[right] {$2\min[v_1,v_2]$};
\end{tikzpicture}
\end{center}
tabular*
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill} } | c | c | c | r | }
\hline
label 1 & label 2 & label 3 & label 4 \\
\hline
item 1 & item 2 & item 3 & item 4 \\
\hline
\end{tabular*}
multirow
{
\begin{table}
\caption{Statistics of the Dataset}
\label{tab:dataset}
\centering
\begin{tabular}{c|c|c|c}
\hline \hline
\multirow{3}{*}{Science} & \multirow{2}{*}{Video} & Count & \\ \cline{3-4}
& & Avg. length & \\ \cline{2-4}
& User & Count & \\ \cline{2-4}
& \multirow{3}{*}{Back-jumps} & Count & \\ \cline{3-4}
& & Max back-jumps/video & \\ \cline{3-4}
& & Min back-jumps/video & \\ \cline{2-4}
\hline \hline
\end{tabular}
\end{table}
}
caption
\usepackage{caption}
\captionsetup[table]{skip=10pt}
pdflatex
\documentclass{article}
\begin{document}
First document. This is a simple example, with no
extra parameters or packages included. \cite{knuthwebsite}.
\end{document}
sudo apt-get install texlive
pdftex /path/to/myfile.tex
bibtex
article.tex
\documentclass{article}
\usepackage{natbib}
\begin{document}
First document. This is a simple example, with no
extra parameters or packages included. \cite{knuthwebsite}.
\bibliographystyle{alpha}
\bibliography{article}
\end{document}
article.bib
@misc{knuthwebsite,
author = "Donald Knuth",
title = "Knuth: Computers and Typesetting",
url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}
Suppose you have article.tex
and article.bib
. You need to run:
- latex article.tex (this will generate a document with question marks in place of unknown references)
- bibtex article (this will parse all the .bib files that were included in the article and generate metainformation regarding references)
- latex article.tex (this will generate document with all the references in the correct places)
- latex article.tex (just in case if adding references broke page numbering somewhere)
Just add the following line to your ~/.bashrc
file (modify the main keyword accordingly to the name of your .tex
and .bib
files)
alias texbib='pdflatex main.tex && bibtex main && pdflatex main.tex && pdflatex main.tex && gnome-open main.pdf'
xelatex
需要用 xecjk
或 zhspacing
设置中文字体。 XeTex
缺省设了英文字体 Latin Modern
,所以你能看到英文字。
\documentclass{article}
\usepackage{xeCJK}
\setCJKmainfont{simsun.ttf}
\setCJKsansfont{simhei.ttf}
\setCJKmonofont{simfang.ttf}
\begin{document}
\title{作业}
\author{宋正阳}
\date{\today}
\maketitle
\end{document}
font
Fontconfig warning: "/etc/fonts/conf.d/65-droid-sans-fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected
sudo apt install --reinstall fontconfig
<test name="lang">
<string>zh-cn</string>
<string>zh-sg</string>
<string>zh-hk</string>
<string>zh-tw</string>
<string>zh</string>
</test>
<test name="lang">
<string>zh-cn</string>
</test>