乐于分享
好东西不私藏

Latex的真理,我已解明!(文档类型篇)

Latex的真理,我已解明!(文档类型篇)

生物力学实验室:

AI交叉科学领域必读的公众号。

我是张运霄,欢迎来到“我已解!”系列推文。
紧接着上一篇Latex的真理,我已解明!(最小模版入门篇),我们了解一下latex文档类型
oo1 documentclass
我们新建一个tex文件,并在里面放下latex模版:
\documentclass{article}\begin{document}Hello LaTex\end{document}
我们已经了解到\documentclass是设置文档类型。文档类型里article是最常用的,但除了它还有很多种。我们只需要把第一行的article改成其他的类型然后再重新编译就可以看到效果。例如article改成report:
\documentclass{report}\begin{document}Hello LaTex\end{document}
接下来我们一个个看
oo2 article
Article适合短文、作业、论文草稿、实验报告、课程总结。没有 \chapter,最高层级一般是 \section。
\documentclass{article}
oo3 report

Report适合较长报告、课程讲义、毕业论文草稿。有 \chapter。

\documentclass{report}
oo4 book
Book适合书籍、长篇论文、正式讲义。有 \part\chapter,默认支持单双页排版、奇偶页页眉等。可以看到pdf页码在右上角
\documentclass{book}
oo5 letter
Letter适合正式信件。看到pdf文字更偏下一些
\documentclass{letter}
oo6 beamer

Beamer用于做学术报告幻灯片。比如组会 PPT、课程汇报。

\documentclass{beamer}

可以看到pdf是PPT的比例,右下角还有PPT的下一页等控制按钮。

beamer编译后会产生更多辅助文件:
在基础的4种类型文件tex,aux,log,pdf基础上,增加了nav,out,snm,tocLatex Beamer做PPT比较特殊,内容丰富,以后会单独给大家出教程
oo7 moderncv
ModernCV适合做简历。但是如果直接编译
\documentclass{moderncv}\begin{document}Hello LaTex\end{document}
会产生错误
...very long...Undefined control sequence.<argument> \@firstname                        {}~\@lastname {}l.3 \begin{document}
这是因为这个文档类型比较特殊,需要额外的必要内容,也就是姓名
\name{Yunxiao}{Zhang}
报错后在cmd里输入x再按回车,就可以退出当前命令。
...very long...! Undefined control sequence.<argument> \@firstname                        {}~\@lastname {}l.4 \begin{document}xNo pages of output.Transcript written on ooModernCV.log.(base) yunxiao@KMac ooStudyBasis % 
加入姓名,现在的tex全文是
\documentclass{moderncv}\name{Yunxiao}{Zhang}\begin{document}Hello LaTeX\end{document}
编译后
用Latex写CV内容也比较丰富,如有需求后期可以出专门教程
oo8 tikzposter

TikzPoster适合做学术海报。

\documentclass{tikzposter}\begin{document}Hello LaTeX\end{document}

但这样直接编译后是空白的

内容需要添加在Block

\documentclass{tikzposter}\begin{document}\block{Test}{Hello LaTeX}\end{document}
oo9 elsarticle
很多学术期刊或会议有自己的内置tex模版,例如Elsevier / APS / PRL / Physical Review / ACM
这是Elsevier的模版
\documentclass{elsarticle}\begin{document}Hello LaTeX\end{document}
编译后会多一个spl文件,
这是效果
oo1standalone
最后是Standalone,只渲染内容本身不渲染页面
\documentclass{standalone}
pdf效果如下,仅有文字
点赞支持本系列,关注获取更多内容。
往期推荐:
Latex的真理,我已解明!(最小模版入门篇)
数学语言Lean4入门:进入数学界最好的方式(2)
Rust语法特性学习【Day7】:Rust独有的空类型()