记录用LaTeX写论文时遇到的相关问题

  记录用LaTeX写论文时遇到的相关问题。

文本 Paragraphs and Texts

LaTeX 希腊字母注音符号特殊字符
201707 LaTeX 希腊字母注音符号特殊字符.jpg
LaTeX中输入空格以及换行
加粗\section{}和\paragraph{}中的文本

  20231129记:Q:在 LaTeX 中,在不修改elsarticle文档类的定义的前提下,如何加粗\section{}和\paragraph{}中的文本?

20231129记:Q:在 LaTeX 中,在不修改elsarticle文档类的定义的前提下,如何加粗\section{}和\paragraph{}中的文本?
注:以下命令显示的章节标题不够美观,有待修改;

\usepackage{titlesec}
\titleformat{\section}
  {\normalfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\paragraph}[runin]
  {\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{\baselineskip}{\baselineskip}

Q:
\titleformat{\paragraph}[runin]
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{\baselineskip}{\baselineskip}请解释这里面各个参数的含义

对于 \titleformat 命令的参数解释如下:
第一个参数 \paragraph 指定要修改格式的标题级别(这里是 \paragraph)。
第二个参数 [runin] 指定标题的格式,runin 表示标题和正文在同一行。
第三个参数 {\normalfont\normalsize\bfseries} 是标题的格式设置。{\normalfont} 恢复正常字体,\normalsize 设置字体大小为正常大小,\bfseries 将文本设置为粗体。
第四个参数 {\theparagraph} 用于在标题前添加标号。{\theparagraph} 表示使用段落的标号作为标题的标号。
第五个参数 {1em} 设置标题标号和标题文本之间的距离为 1em。

对于 \titlespacing 命令的参数解释如下:
第一个参数 \paragraph 指定要修改间距的标题级别(这里是 \paragraph)。
第二个参数 {0pt} 设置标题左侧的间距为 0pt,即紧贴左侧边界。
第三个参数 {\baselineskip} 设置标题的上方间距为正常行高。
第四个参数 {\baselineskip} 设置标题的下方间距为正常行高。

公式 Mathematics

多行公式及公式对齐

图片 Images

表格 Tables

较为复杂的表格样式参考

20231119记:谷歌图片检索"overleaf table template, examples, journal",必应国际版检索"tabularray overleaf",百度检索"tabularray overleaf",

20231119记:LaTeX 表格画斜线,
  谷歌检索"LaTeX table diagboxthree",

参考文献 Bibliographies and references

如何快速下载一篇经典文章的所有参考文献? 20181113

  • Q:LaTeX命令,\citep \citet \cite 三者有何区别?
  • Q:LaTeX命令,~\cite \cite 两者有何区别?
u can’t recreate a .bib file from the .bbl file

BBL File Format Information
bibtex - Convert .bbl file to .bib file - TeX - LaTeX Stack Exchange 20140925

xxx.bib中的参考文献条目编辑
xxx.tex
\bibliographystyle{elsarticle-num}
\bibliography{xxx.bib}

xxx.bib
@inproceedings{wu2023timesnet,
  title={TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis},
  author={Haixu Wu and Tengge Hu and Yong Liu and Hang Zhou and Jianmin Wang and Mingsheng Long},
  booktitle={International Conference on Learning Representations},
  year={2023},
  % pages={},  % 该条目缺失会提示empty pages in wu2023timesnet"
}
连续的参考文献编号改用破折号连接, 比如[6,7,8,9]变成[6-9]?

20231206记:Q:如何使连续的参考文献能够中间用破折号连起来?比如[6,7,8,9]变成[6-9]?
A:在 .tex 文件的开头,加上 \usepackage[numbers,sort&compress]{natbib},如果该命令在编译时会报错的话,则试试以下修改:

\documentclass[review,numbers,sort&compress]{elsarticle}
\usepackage{natbib}

20231206记:(Poe,GPT-3.5-Turbo)Q:

\usepackage[numbers,sort&compress]{natbib}
LaTeX Error: Option clash for package natbib.
The package natbib has already been loaded with options:
[numbers]
There has now been an attempt to load it with options
[numbers,sort&compress]
Adding the global options:
numbers,numbers,sort&compress
to your \documentclass declaration may fix this.
Try typing <return> to proceed.

A: The error message indicates that the natbib package has already been loaded with the [numbers] option, and there is an attempt to load it again with additional options [numbers,sort&compress]. However, the package can only be loaded once with a specific set of options.
To resolve this issue, you can modify your \documentclass declaration to include the desired options. Here’s an example:

\documentclass[numbers,sort&compress]{article}
\usepackage{natbib}

\begin{document}

文献引用示例:\cite{ref1, ref2, ref3}

\bibliographystyle{plain}
\bibliography{your-bibliography-file}

\end{document}

In this example, the numbers and sort&compress options are added directly to the \documentclass line. Then, the natbib package is loaded without any options. Make sure to replace your-bibliography-file with the actual filename of your .bib file (without the file extension).
By adding the options to the \documentclass declaration, you can avoid the option clash and use the desired option combination for the natbib package.

算法伪代码

代码块

.cls file

.cls file 变量的定义

20240729记:
  LaTeX 的 .cls file 中有多处需要用到同一个路径,由于路径比较长,为了避免简洁起见,在想能不能先将该路径定义为一个变量,然后在用到该路径的地方调用该路径变量。例如,

% LaTeX, in the .cls file

% 改动前:
\setCJKmainfont[Path=D:/OtherProgramFiles/Portable/TeXLive_WorkSpace/font4Thesis/ ,AutoFakeBold = {2.25},ItalicFont={simkai.ttf}]{SimSun.ttf}
\setCJKsansfont[Path=D:/OtherProgramFiles/Portable/TeXLive_WorkSpace/font4Thesis/,AutoFakeBold = {2.25},ItalicFont={simkai.ttf}]{SimHei.ttf}

% _modify0729:将字体路径修改如下
\newcommand{\myfontpath}{D:/OtherProgramFiles/Portable/TeXLive_WorkSpace/font4Thesis/}
\setCJKmainfont[Path=\myfontpath ,AutoFakeBold = {2.25},ItalicFont={simkai.ttf}]{SimSun.ttf}
\setCJKsansfont[Path=\myfontpath ,AutoFakeBold = {2.25},ItalicFont={simkai.ttf}]{SimHei.ttf}

  百度检索"LaTeX .cls 定义 路径变量",谷歌检索"LaTeX define variable of path in .cls file"“LaTeX include path in .cls file”,

PPT 画图

PPT 画图插入 LaTeX 中

20231112记:

方式一:

  • Step 1. 在 PPT 中画图;
  • Step 2. 点击"文件 | 导出 | 创建 Adobe PDF",在弹出的"另存 Adobe PDF 文件为"窗口的"选项(O)“中可以指定"PDF 选项"和"幻灯片范围”,便可导出生成 pdf 文件;
  • Step 3. 使用 pdf 裁剪工具 Crop PDF Online: Click & Drag to Crop Your PDF | AvePDF,对 pdf 文件中图片的四周空白部分进行裁剪;
  • Step 4. 在 LaTeX 中插入 .pdf 文件;

20220615记:

方式二:

  • Step 1. 在 PPT 中画图,调整幻灯大小使得目标图表四周均匀留白。调整幻灯片大小的方法:设计->幻灯片大小->自定义幻灯大小,弹出窗口选择"最大化",保证你作的图不会缩小;
  • Step 2. 文件->另存为 PDF(*.pdf),e.g., 179 Kb;在"选项(O)…“窗口,勾选"范围:当前幻灯片”;在"工具(L)->压缩图片(\C)…“窗口,勾选"目标输出:使用文档分辨率”;
  • Step 3. 在 LaTeX 中插入 .pdf 文件;

方式三:

  • Step 1. 在 PPT 中画图,调整幻灯大小使得目标图表四周均匀留白。调整幻灯片大小的方法:设计->幻灯片大小->自定义幻灯大小,弹出窗口选择"最大化",保证你作的图不会缩小;
  • Step 2. 文件->另存为 增强型 Windows 元文件(*.emf),e.g., 8.64 Mb;;在"工具(L)->压缩图片(\C)…“窗口,勾选"目标输出:使用文档分辨率”;注:如果是另存为 PNG 可移植网络图形格式 (*.png),虽然文件大小只有 e.g. 369 Kb, 但是分辨率很不清晰;
  • Step 3. 使用画图工具打开 .emf 格式图片,然后另存为 .png 格式图片;
  • Step 4. 在 LaTeX 中插入 .png 文件;

  

待补充

  

待补充

  



文字居中

数学公式粗体 \textbf{} 或者 m e m o r y {\bf memory} memory
数学公式粗斜体 \bm{}

摘录自“bookname_author”

高亮颜色说明:突出重点
个人觉得,:待核准个人观点是否有误

分割线

分割线


我是颜色为00ffff的字体
我是字号为2的字体
我是颜色为00ffff, 字号为2的字体
我是字体类型为微软雅黑, 颜色为00ffff, 字号为2的字体
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值