My LaTeX Tricks
🎓
😏 Writing neat is fun and enjoyable.
🚀
Useful Commands
Some commands that are not easy to search for.
\phantom{}
Use \phantom{}
(/'fæntəm/) to generate a empty space with desired horizontal length.
Google results of “latex phantom”.
For example:
1 | \begin{aligned} |
generates (Notice the alignment at the beginning of the second line)
\raisebox{}{}
The baseline of an image is at the bottom. You could use \raisebox to shift it up. Use half of \height, which stands for the height of the box to be raised.
1 | \raisebox{-.5\height}{\includegraphics{some_picture}} |
My Preambles
Common
1 | %%%%%%%% personal preamble starts %%%%%%%% |
Special for pdflatex
1 | % [must use] & [put at the beginning] |
Special for xelatex
1 | % [not needed] |
Problems and Solutions
Only keep a record of those ot easy to search for a solution.
Half-solved
Case-01
“Fragile” problem with\caption
and\newcommand
with an optional argument.
1 | Use a command with an optional parameter defined by `\newcommand[1][]{\ph}{#1}` will fail in the figure caption, |
It turns out that this is incorrect, at least not fully correct.
This problem roots in the template of AAS.cls
for the American Astronautical Society (AAS) conference.
Using \newline
rather than \\
in the caption solves the problem perfectly.
Completely-solved
Workflows
When | Then |
---|---|
Prepare a single equation. | codecogs is best. |
Write one paragraph including both inline and display equations. | vscode + markdown plugin is better, then copy-paste to texstudio. |
Revise context and equations. | texsutio inline preview is more convenient. |