Table of contents
(Feature image from: latex · GitHub Topics · GitHub)
Basics
文档页面旋转90度
Rotate a page 180 degrees in LaTeX
For the whole document:
|
|
交叉引用替换为文字
用法:
|
|
\ref{label_name} 只是数字
Cross-references
\pageref{key} command, which prints the number of the page where the \label{key} was inserted.
Basic usage
(2021-01-15)
|
|
引用
条目后显示页码
(2024-06-22)
-
Use package
backref.(Ask chatGPT4o: “How to add the page number where a reference gets cited behind the entry item automatically in latex”)
\usepackage[backref=page]{hyperref}(Ref: Backref package for page reference Found in DDG)
显示引用自某一页
(2024-06-22)
|
|
-
Use package
biblatexReferencing page number with only one reference (Found in DDG)
公式
矩阵每行加 label
|
|
-
Example: overleaf DIP assign 3
-
Suitable for R markdown Label rows and columns of a matrix in R Markdown with Latex and HTML rendering
Vector arrow
(2024/06/21)
Search: "" in DDG
-
Use
xshlongvec
Fonts
-
Bold and italic
(2024-06-23)
-
Caligraphy:
\mathcal, where\cal fwill make the entire line to be caligraphy. -
公式加框 (ChatGPT: Using
\textbf{},\textit{}, or\boxed{}for Emphasis)1\boxed{E = mc^2}
长公式换行
(2024-06-23)
-
\begin{aligned}
文字颜色
(2024/07/17)
-
Use package xcolor:
1 2 3\usepackage[dvipsnames]{xcolor} {\color{ForestGreen} Sentences to be highlighted}. -
论文新加内容用森林绿 ForestGreen,删除内容用砖红色 BrickRed
1 2 3{\color{BrickRed} \sout{Text to be deleted} }
两组公式并排
References:
Notes:
(2025/02/08)
-
Use
$$ \begin{array}{c|c} \begin{aligned} x + y = 35 \end{aligned} & \begin{aligned} 2x + 4y = 94 \end{aligned} \end{array} $${array}environment -
Use
{align*}environment r1-DS:$$ \begin{align*} x + y &= 5 && \text{and} && 2x - y &= 3 \\\ a &= b + c && \text{or} && d &= e - f \end{align*} $$1 2 3 4\begin{align*} x + y &= 5 && \text{and} && 2x - y &= 3 \\\ a &= b + c && \text{or} && d &= e - f \end{align*}
推导注释
References:
-
DeepSeek
- Prompt: “What are the conventions for adding comments in formula derivations?”
Notes:
(2025/02/08)
-
intertextdoesn’t work in markdown$$ \begin{align} F &= ma \\ &= m \cdot \frac{dv}{dt} \intertext{Since acceleration is the derivative of velocity} &= \frac{d}{dt} (mv) \end{align} $$1 2 3 4 5\begin{align} F &= ma \\ &= m \cdot \frac{dv}{dt} \intertext{Since acceleration is the derivative of velocity} &= \frac{d}{dt} (mv) \end{align} -
stackrel
$$ x \stackrel{\text{def}}{=} y + z $$1x \stackrel{\text{def}}{=} y + z
删除线
Problems:
\cancel{}是斜线,如何在文字上加 strikethrough
References:
Notes:
(2025-05-13T23:19)
- Use package
ulemand command\sout{}r1-元宝
代码
插入代码块
matlab Highlighting MATLAB Code in LaTeX with mcode
高亮行内代码
(2024-06-20)
-
Use package
xparse -
Use
\texttt{}:\texttt{Under\_scores\_}need to be escaped.
Table
Table每行自动标号
使用 counter
|
|
How does the \newcolumntype command work?
w{c}{0.1em} 是控制对齐和列宽
长表格自动换页
latex long table automatic move to next page
\usepackage{longtable}
Multi-page tables using \longtable
里面不能用 tabular 环境,不过据说它支持大部分tabular 特性
|
|
表格内换行
-
cell 内部再用个 tabular 环境:
\begin{tabular}[t]{@{}p{\linewidth}@{}}PlenOctrees for Real-time Rendering of Neural Radiance Fields \\ ICCV 2021 Oral \end{tabular} -
\newline ICCV 2021
表格列宽
(2024/10/03)
-
Vertical:
p,m,b, Horizontal:\raggedright(left-align),\centering,\raggedleft(righ-align)1 2 3 4 5 6 7 8 9 10 11\usepackage{array} %----- \begin{tabular}{p{0.2\textwidth}>{\centering}p{0.2\textwidth}>{\centering}p{0.2\textwidth}>{\centering\arraybackslash}p{0.2\textwidth}} \hline \multirow{2}{*}{Country}&\multicolumn{2}{c}{Population}&\multirow{2}{*}{Change (\%)}\\\cline{2-3} &2016&2017&\\ \hline China&1,403,500,365&1,409,517,397&+0.4\%\\ \hline \end{tabular}- Ref: Control the width of table columns (tabular) in LaTeX - texblog (Searched by “latex table column width and align” in DDG)
1个cell内多行
(2024/10/03)
-
Use package
multirow
- Ref: Control the width of table columns (tabular) in LaTeX - texblog (Searched by “latex table column width and align” in DDG)
缩放表格
References:
-
Is there a way to slightly shrink a table, including font size, to fit within the column boundaries?
-
Missing \endgroup inserted.
\endgroup \end{tabular}} when using \scalebox - LaTeX Stack Exchange - Searched by
latex threeparttable Missing \endgroup inserted.in DDG
- Searched by
-
Use resizebox with math mode; Missing } inserted - TeX - LaTeX Stack Exchange
- Searched by
latex resizebox Missing \endgroup inserted.in DDG
- Searched by
-
- Prompted by
I am using a double-column layout in Latex. How to resize a table to fix the width of a single column? Please do not use \resizeboxin
- Prompted by
Notes:
|
|
(2024/10/03)
-
resizeboxdoesn’t compatible with Springer Nature templateThe following snippet will run into errors:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18\begin{table}[htbp] \centering \caption{Number of Points} \resizebox{\textwidth}{!}{ \begin{tabular}{llllllllllll} \toprule Method & Scan1 & Scan4 & Scan9 \\ \hline COLMAP & 388 & 449 & 91 \\ CasMVSNet & 0.63 M & 0.57 M & 0.42 M \\ \hline Method & Scan32 & Scan33 & Scan34 \\ \hline COLMAP & 322 & 110 & 332 \\ CasMVSNet & 0.45 M & 0.26 M & 0.61 M \\ \bottomrule \end{tabular} \label{tab:n_points_dtu} } % curly brace of resizebox \end{table}Error:
1 2 3 4Missing \endgroup inserted. Missing } inserted. LaTeX Error: \begin{threeparttable} on input line 440 ended by \end{tabular}. Package graphics Error: Division by 0.Processing: I gave up using
resizebox.
(2024/11/13)
-
Use
{tabularx}(Prompted by r4-Chat)- Do not forget
\usepackage{tabluarx}
1 2 3 4 5 6 7 8 9 10 11\begin{table}[ht] \centering \begin{tabularx}{\columnwidth}{XXX} \hline Header 1 & Header 2 & Header 3 \\ \hline Data 1 & Data 2 & Data 3 \\ \hline Data 4 & Data 5 & Data 6 \\ \hline \end{tabularx} \caption{Table caption} \label{tab:example} \end{table} - Do not forget
label
(2024-06-20)
-
Add label before \end{table} labels with tabular
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18\documentclass{article} \begin{document} Critical temperature for different Type I superconductors is given in Table~\ref{Tab:Tcr} \begin{table}[ht] \caption{My Table} \centering \begin{tabular}{l l} material & T [K]\\ \hline Sn & 3,7 \\ Pb & 7,2 \\ Al & 1,2\\ \end{tabular} \label{Tab:Tcr} \end{table} \end{document}
Table Notes
(2024-07-07)
Ref: Zeng’s thesis:
|
|
Paper tips
(2024-03-21)
guanyingc/latex_paper_writing_tips
Plots
画程序流程图
Code using algorithm2e package
画坐标系
Coordinate system in LaTeX with TikZ
Overfull \hbox with pgfplots graph
画夹角
How to draw a simple angle, two intersecting lines Tikz
画圆柱体
generate simple cylindrical shape with text in latex (tikz)
Learn How to Draw a Cylinder Shape in TikZ
同步缩放 TikZ 与其中的 node
Tikz Examples
(2024-04-11)
Example of Petar Veličković X
Inkscape
(2024-04-23)
-
生成 latex 代码
-
Problems:
(2025-09-12T09:56)
-
我想用 Quarto 写 slides,但是它不支持 GoAT。
我喜欢 GoAT ascii art, 是因为我在终端里看文档的时候,也可以看到“图”。
次于以上的方法是:我想把图和文字放在一起,而 不用单独保存图片文件, 就像 tikz 和 latex 那样,图片在 build 时转换成 svg, 但是我不会写 tikz
-
InkScape 可以将矢量图形导出成 .tex 代码,那我应该就可以加入 Quarto 里面了? 但是把全部代码粘贴到文档中,可能太长了,还是另存为一个文件吧。
-
Tex 代码虽然不如 GoAT 那么直观,但是可以用于制作 Quarto slides, 而 slides 最好还是在浏览器上看吧,终端里看不了。
-
-
References: {{{
-
【InkScape+LaTeX】如何绘制矢量图并优雅地用在LaTeX文档中? - bilibili - 豪底狄
- Searched by
inkscape科研绘图at bilibili
- Searched by
-
【InkScape+LaTeX】如何绘制矢量图并优雅地用在LaTeX文档中? - bilibili - 豪底狄
-
Supports:
(2025-09-12T09:55)
-
在 GUI 中绘制,之后另存为 pdf,同时会生成 .pdf_tex 文件,然后将其加入 .tex r1-LaTex
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\documentclass{article} \usepackage{graphicx} \usepackage{xcolor} % 如果 svg 图片中含有数学公式,则需要使用数学库 \usepackage{} \begin{document} \begin{figure} \def\svgwidth{\columnwidth} \input{output.pdf_tex} \end{figure} \end{document}
Take Lecture Notes
(2024-04-23)
-
How I’m able to take notes in mathematics lectures using LaTeX and Vim (Found Gilles Castel as he was followed by cxzhou35 on Github.)
PseudoCode
长伪代码跨栏
Placing a single algorithm in two columns
|
|
把算法 内容 用 \begin{multicols}[2] ... \end{multicols} 包起来,而不是在 \begin{algorithm} ... \end{algorithm}外面。
Comments
(2024-06-01)
-
Curious how to add comments like this:
-
3DGS paper 里是一样的 pdf
References:
-
Algorithms - Overleaf, Online LaTeX Editor
- Searched by
latex pseudocode block algorithm commentin DDG
- Searched by
-
algorithms - How do you add a comment to pseudocode in LaTeX? - TeX - SE
Notes:
(2024-10-24)
-
Overleaf has the same style comments (Pcmt-Ovrl):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\documentclass{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm} \caption{An algorithm with caption}\label{alg:cap} \begin{algorithmic} \State $N \gets \frac{N}{2}$ \Comment{This is a comment} \end{algorithmic} \end{algorithm} \end{document} -
The
\COMMENT{}of the packagealgorithmsdoesn’t work in Overleaf. (Pcmt-SE)
(2024-07-08)
-
Examples for comments:How to Write Algorithm Pseudo Code in LaTeX · Blowfish - GitHub Pages (Found in DDG)
-
Search: “abbreviation for algorithm in academic paper for pseudocode” in DDG
-
Pseudocode 1 Guidelines for writing pseudocode - University of Waterloo (Found in pseudocode-s2)
-
Pseudocode Best Practices - University of British Columbia (Found in pseudocode-s2)
Link Color
(2024/06/15)
-
hyperref options: overleaf Docs
1 2\usepackage[hidelinks]{hyperref} \hypersetup{colorlinks=true,allcolors=blue} % affect toc-
Set each option individually:
\hypersetup{colorlinks=true,linkcolor=blue, citecolor=blue} -
The option
linktoc=pagemay remove the links attached on titles texts in the table of contents:\tableofcontents, and the page numbers get links.
Ref:
-
Images
|
|
多张图片并排
|
|
(2024-06-20)
-
Use
\subcaptionbox, without using any new package. (Found when ask chatGPT to revise the above code.)- subfigure has been deprecated?
1 2 3 4 5 6 7 8 9 10 11 12\begin{figure}[H] \centering \subcaptionbox{pic1\label{fig:subfig:onefunction}}{ \includegraphics[scale=0.3]{sections/Images/240520.jpg} } \hfill \subcaptionbox{pic2\label{fig:subfig:twofunction}}{ \includegraphics[scale=0.3]{sections/Images/240520.jpg} } \caption{2pics} \label{fig:twopicture} \end{figure}Effect:
(2024-07-09)
-
3x2 images array:
Code snippet
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\documentclass{article} \usepackage{graphicx} \usepackage{subcaption} \begin{document} \begin{figure}[htbp] \centering \begin{minipage}[b]{0.45\textwidth} \centering \includegraphics[width=\textwidth]{pic1} \caption*{(a) pic1} \end{minipage} \begin{minipage}[b]{0.45\textwidth} \centering \includegraphics[width=\textwidth]{pic2} \caption*{(b) pic2} \end{minipage} \vspace{0.5cm} % Space between rows \begin{minipage}[b]{0.45\textwidth} \centering \includegraphics[width=\textwidth]{pic3} \caption*{(c) pic3} \end{minipage} \begin{minipage}[b]{0.45\textwidth} \centering \includegraphics[width=\textwidth]{pic4} \caption*{(d) pic4} \end{minipage} \vspace{0.5cm} % Space between rows \begin{minipage}[b]{0.45\textwidth} \centering \includegraphics[width=\textwidth]{pic5} \caption*{(e) pic5} \end{minipage} \begin{minipage}[b]{0.45\textwidth} \centering \includegraphics[width=\textwidth]{pic6} \caption*{(f) pic6} \end{minipage} \caption{6pics} \label{fig:six_pics} \end{figure} \end{document}
minipage
|
|
Insert svg
(2024/06/16)
Ref: How to Use SVG Images in LaTeX | Baeldung
Use package: \usepackage[inkscapearea=page]{svg}
|
|
Span 2 Cols
References:
- Prompt for ChatGPT: “How to make a wide image displayed across two columns?”
Notes:
-
Use
figure*environment: r1-Chat1 2 3 4 5 6 7 8\documentclass[iicol]{sn-jnl} \begin{figure*}[ht] \centering \includegraphics[width=\textwidth]{your_image_file.png} \caption{Your caption here} \label{fig:wide_image} \end{figure*}
Manage
Version Control
References:
-
- Searched by
Should I use git to manage latex project?in DDG
- Searched by
Use Git
Notes:
(2024/12/08)
- Fesible r1-Reddit
Caption
Notes:
(2024/12/16)
-
Cancel the
:afterFig. 1(MVA requirement)1 2\usepackage{caption} \captionsetup[figure]{labelsep=space}-
Asked ChatGPT and Claude:
In latex, how to cancel the : after figure index, to satisfy the journal requirement:
Figure captions begin with the term Fig. in bold type, followed by the figure number, also in bold type. No punctuation is to be included after the number, nor is any punctuation to be placed at the end of the caption.
-
编号
Notes:
(2024/12/16)
-
Appendix 中的表格的编号 继续 正文的编号,而不是
A11 2 3 4 5\begin{appendices} \renewcommand{\thetable}{\arabic{table}} % Reset table numbering to Arabic \setcounter{table}{2} \section{Table of number of points}\label{secA1}- Answered by ChatGPT
Editors
Vim
Problems:
- Overleaf’s editor is not good.
References:
Notes:
(2025-05-03T19:47)
- 用 nvim 插件实现编译快捷键r1-柯基