這邊是使用Latex時,一些我常遇到的問題
1. 符號類
在latex中 %是comment的符號。
所以要顯示出百分比符號,要用跳脫字元 \%
ex. 100 \%
溫度的符號,可以用上標+小圈圈來解決: $^{\circ}$
ex. 35$^{\circ}$
quantum 中的 h bar 輸入的方法為 $\hbar$
ex. 2$\hbar$
italic ABC 可以用 \textit{ABC},
而\emph{ABC} 的效果預設是斜體,但是preamble地方改變\emph的行為,
所以會以可能會有不同的效果。
math mode 可以用 \textrm{} 或是 \mathrm{}
理論上,text 的部份用\textrm{} 而mathematical symbol 用 \mathrm{}
在Latex中如果 < or > 會產生顛倒過來的問號,那是編碼的問題,
替代方式為 \textless 與 \textgreater or $<$ or $>$
see the reference.
vector or hat
\vec{a}, \hat{c}
good reference for table
在table中使用footnote的相關問題,
因為原生的Latex對於table的支援並不是很好,所以後來有許多套件。
threeparttable -- 使footnote直接出現在table下方,而不是頁面下方。
在preamble 加入:\usepackage{threeparttable}
在要放註解的地方用 \tnote{}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
\begin{table} \begin{threeparttable} \caption{...} \begin{tabular}... here is the table content \tnote{1} \end{tabular} \begin{tablenotes} \item [1] the first note ... \end{tablenotes} \end{threeparttable} \end{table} |
tabularx -- 使小的table也能擴展到整個頁寬
在preamble 加入:\usepackage{tabularx}
要使用自訂column type的技巧
ex.
\newcolumntype{Y}{>{\small\raggedright\arraybackslash}X}
\newcolumntype{C}{>{\small\centering\arraybackslash}X}
\reggedright 是去掉右邊的paragrah indentation
\small是把自行改小一點的意思。 然後 Y 與 C 就可以使用在下面的taularx的parameter中
ex. \begin{tabularx}{\textwidth}{CCCC}
format:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
\begin{table} \begin{threeparttable} \caption{...} \newcolumntype{Y}{>{\small\raggedright\arraybackslash}X} \newcolumntype{C}{>{\small\centering\arraybackslash}X} \begin{tabularx}{\textwidth}{Y|C|CCC} here is the table content \tnote{1} \end{tabularx} \begin{tablenotes} \item [1] the first note ... \end{tablenotes} \end{threeparttable} \end{table} |
如果需要 long table的話, i.e. for longtable + tabularx
\usepackage{ltxtable}
如果在一個表格中,需要對齊 decimal point
可以用 \usepackage{dcolumn}
在表格的的標題中使用數學,則需要 textcase package.
\usepackage{textcase}
bibliography 系列
to use the order that appear in the content.
\bibliographystyle{ieeetr}
\bibliography{myrefs}
for clustering the citing number:
也就是 [ 1-5], instead of [1,2,3,4,5]
\usepackage[noadjust]{cite}
for back reference.
也就是在reference的地方出現 author, XXX, (page 1 )
可以使用biblatex
\usepackage[backref=true]{biblatex}
\usepackage{hyperref}
\DefineBibliographyStrings{english}{%
backrefpage ={page},% originally "cited on page"
backrefpages ={pages},% originally "cited on pages"}
see reference.
to use different font for code.
http://tex.stackexchange.com/questions/24840/use-courier-font-inline-on-text