Latex Packages & Tricks by Mengting Wan

转载自:https://github.com/MengtingWan/bittersweet-phd/blob/master/latex.md

 

Table of Contents:

Latex Packages & Tricks

Things could make your writing easier and your paper more professional.

Overleaf is a convenient online collaborative latex writing platform. It also provides some basic latex writing tips here.

Control float environments

  • A comprehensive answer!
    • Some parameters in the above document could be very helpful
    • e.g. put \setlength{\textfloatsep}{5pt plus 1pt minus 1pt}(default 20pt plus 2pt minus 4pt) before \begin{document}, this would save a lot of space between top or bottom tables/figures and the text area
  • Options b and h are disabled for table* and figure* environments (cross-column tables and figures)

"subcaption": Create sub-figures and sub-tables

"enumitem": Control layout of itemize, enumerate & description

"enumitem" is a very helpful package if you want to reduce spaces in itemize/enumerate environments

import the package first: \usepackage{enumitem} then put \setlist{nosep,after=\vspace{0.5\baselineskip},leftmargin=12pt} before before \begin{document}, this would (globally) remove separations between items, reduce the space at the bottom of list environments and reduce the left indentation to 12pt.

"booktabs": Beautiful tables

"booktabs" might be one of the most popular latex packages in academic writing.

pandas.DataFrame.to_latex(): Dump data from Python to LaTex

pandas.DataFrame.to_latex() would render a pandas.DataFrame object in python to a LaTeX tabular environment "booktabs"-style table.

"makecell": Force line breaks inside a table cell

This package can be very helpful if you want to force line breaks inside a table cell

"tabularx": Tabulars with adjustable-width columns

Quotation Marks and Dashes

  • Single quotation marks: ` and '
  • Double quotation marks: `` and ''
  • Even fancier examples
  • Dashes:
    • - inter-word
    • -- page range, 1–10
    • --- punctuation dash
    • $-$ minus sign

Resize parentheses, brackets and braces

Overbrace and underbrace

\[
 z = \overbrace{
   \underbrace{x}_\text{real} + i
   \underbrace{y}_\text{imaginary}
  }^\text{complex number}
\]

Math symbols and fonts

"bm": A lazy solution to bold symbols in maths mode

"mathtools": Beautiful maths

"cleveref": A clever way to reference

"cleveref" can help us to define unified reference formats in the global environment, so that we can keep using \cref{} regardless of the specific reference types (equation, section, etc.) in the document.

"xcolor": Color your LaTex

posted @ 2020-01-23 20:31  雪球球  阅读(336)  评论(0编辑  收藏  举报