今天开始文字加粗、斜体和下划线和添加图片,详细的内容参考overleaf官网。
粗体,斜体和下划线
字体加粗:加粗字体使用 \textbf{} 命令。
字体斜体:斜体使用 \textit{} 命令。
字体下划线:下划线使用 \underline{} 命令。
Some of the \textbf{greatest}
discoveries in \underline{science}
were made by \textbf{\textit{accident}}.
命令 \emph 同样可以达到强调文本的目的(emph是 emphasize的缩写),其行为方式取决于上下文(context)。当上下文是普通文本中, \emph 将目标文本转变为斜体, 当上下文是斜体文本时,则变成普通文本。
Some of the greatest \emph{discoveries}
in science
were made by accident.
\textit{Some of the greatest \emph{discoveries}
in science
were made by accident.}
\textbf{Some of the greatest \emph{discoveries}
in science
were made by accident.}
添加图片
在 overleaf 界面左上角点击上传按钮,选择本地图片文件上传。上传图片
\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {images/} }
\begin{document}
The universe is immense and it seems to be homogeneous,
in a large scale, everywhere we look at.
\includegraphics[width=4cm, height = 5cm]{beauty.jpg}
There's a picture of a galaxy above
\end{document}
本身不能管理图像,因此需要使用一个 包 (package)。在这个例子中,要实现在文档中添加图片,因此需要使用 graphicx 包。graphicx 包提供了新的命令 \includegraphics{...} 和 \graphicspath{...}。要使用 graphicx 软件包,要现在序言中添加:\usepackage{graphicx}, \graphicspath{{images/} } 告诉latex这些图像保存在当前目录下名为 images 的文件夹中。\includegraphics[width=4cm, height = 5cm]{beauty.jpg}命令是将图像实际包含在文档中的命令,并制定宽度和高度。