mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge branch 'master' of https://github.com/LCTT/TranslateProject into translating
This commit is contained in:
commit
b4e8e952c1
@ -3,53 +3,56 @@
|
||||
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14943-1.html"
|
||||
|
||||
在 Linux 上截屏的 3 种方法
|
||||
======
|
||||
通过使用我最喜欢的工具之一在 Linux 上截屏来节省时间。
|
||||
|
||||
![Digital creative of a browser on the internet][1]
|
||||
> 使用我最喜欢的工具在 Linux 上截屏,可以节省时间。
|
||||
|
||||
在写开源软件时,我更喜欢展示一些截图来帮助演示我在说什么。古语有云,一图胜千言。如果你能展示一件事,那通常比仅仅试图描述它要好。
|
||||
![](https://img.linux.net.cn/data/attachment/album/202208/18/172307e5du1dxqd66d66cm.jpg)
|
||||
|
||||
在写开源软件时,我更喜欢展示一些截图来帮助演示我在说什么。古语有云,一图胜千言。如果你能展示一件事,那通常比试图用言语描述它要好。
|
||||
|
||||
有几种方法可以在 Linux 中截图。以下是我在 Linux 上用于捕获截图的三种方法:
|
||||
|
||||
### 1. GNOME
|
||||
### 1、GNOME
|
||||
|
||||
GNOME 有一个很棒的内置截图工具。只需按下键盘上的 **PrtScr** 键,GNOME 就会显示一个截图对话框:
|
||||
GNOME 有一个很棒的内置截图工具。只需按下键盘上的 `PrtScr` 键,GNOME 就会显示一个截图对话框:
|
||||
|
||||
![Image of GNOME screenshot tool][2]
|
||||
|
||||
默认操作是抓取区域的截图。这是一种在你制作截图时裁剪截图的非常有用的方法。只需将高亮显示框移动到你需要的位置,然后使用“抓取”角来更改大小。或选择其他图标之一以截取整个屏幕或系统上的单个窗口。点击圆圈图标进行截图,类似于手机上的“拍照”按钮。 GNOME 截图工具将截图保存在图片文件夹内的截图文件夹中。
|
||||
默认操作是抓取区域的截图。这是一种在你制作截图时裁剪截图的非常有用的方法。只需将高亮显示框移动到你需要的位置,然后使用“抓取”角来更改大小。或选择其他图标之一以截取整个屏幕或系统上的单个窗口。点击“圆圈”图标进行截图,类似于手机上的“拍照”按钮。 GNOME 截图工具将截图保存在图片文件夹内的截图文件夹中。
|
||||
|
||||
### 2. GIMP
|
||||
### 2、GIMP
|
||||
|
||||
如果你需要更多截图选项,你可以使用流行的图像编辑器 GIMP 截图。要进行截图,请选择**文件**并选择**创建**子菜单,然后选择**截图**。
|
||||
如果你需要更多截图选项,你可以使用流行的图像编辑器 GIMP 截图。要进行截图,请选择“<ruby>文件<rt>File</rt></ruby>”并选择“<ruby>创建<rt>Create</rt></ruby>”子菜单,然后选择“<ruby>截图<rt>Screenshot</rt></ruby>”。
|
||||
|
||||
![Image of the GIMP screenshot menu][3]
|
||||
|
||||
该对话框允许你截取单个窗口、整个屏幕或仅一个区域的屏幕截图。我喜欢这个工具可以让你设置一个延迟:多长时间直到你选择窗口,多长时间之后截图。当我想截取菜单操作的截图时,我经常使用此功能,因此我有足够的时间去窗口打开菜单。
|
||||
该对话框允许你截取单个窗口、整个屏幕或仅一个区域的屏幕截图。我喜欢这个工具可以让你设置一个延迟:选择窗口后多长时间,按下截图后多长时间。当我想截取菜单操作的截图时,我经常使用此功能,因此我有足够的时间去窗口打开菜单。
|
||||
|
||||
GIMP 将截图作为新图像打开,你可以对其进行编辑并保存到你喜欢的位置。
|
||||
|
||||
### 3. Firefox
|
||||
### 3、Firefox
|
||||
|
||||
如果你需要截取网站的截图,请尝试使用 Firefox 的内置截图程序。右键单击网页正文中的任意位置,然后从菜单中选择**截图**:
|
||||
如果你需要截取网站的截图,请尝试使用 Firefox 的内置截图程序。右键单击网页正文中的任意位置,然后从菜单中选择“<ruby>截图<rt>Take Screenshot</rt></ruby>”:
|
||||
|
||||
![Image of screenshot utility][4]
|
||||
|
||||
Firefox 切换到模态显示并提示你单击或拖动页面以选择区域,或使用其中一个图标保存整个页面的副本或仅在浏览器中可见的内容:
|
||||
Firefox 切换到模态显示,并提示你单击或拖动页面以选择区域,或使用其中一个图标保存整个页面的副本,或仅在浏览器中可见的内容:
|
||||
|
||||
![Image of Firefox modal display][5]
|
||||
|
||||
当你在屏幕上移动鼠标时,你可能会注意到 Firefox 会高亮显示某些区域。这些是页面上的块元素,例如 `<div>` 或其他块元素。单击该元素以对其进行截图。 Firefox 将截图保存到你的**下载**文件夹,或你设置为“下载”位置的任何位置。
|
||||
当你在屏幕上移动鼠标时,你可能会注意到 Firefox 会高亮显示某些区域。这些是页面上的块元素,例如 `<div>` 或其他块元素。单击该元素以对其进行截图。 Firefox 将截图保存到你的下载文件夹,或你设置为“下载”位置的任何位置。
|
||||
|
||||
如果你尝试记录流程,那么截图可以为你节省大量时间。尝试使用其中一种方法在 Linux 上截图。
|
||||
如果你尝试记录流程,那么截图可以为你节省大量时间。
|
||||
|
||||
图片来源:(Jim Hall,CC BY-SA 40)
|
||||
尝试使用其中一种方法在 Linux 上截图。
|
||||
|
||||
(图片来源:Jim Hall,CC BY-SA 40)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -58,7 +61,7 @@ via: https://opensource.com/article/22/8/screenshots-linux
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,229 +0,0 @@
|
||||
[#]: subject: "Create beautiful PDFs in LaTeX"
|
||||
[#]: via: "https://opensource.com/article/22/8/pdf-latex"
|
||||
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "Donkey"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Create beautiful PDFs in LaTeX
|
||||
======
|
||||
Use the LaTeX markup language to compose documents.
|
||||
|
||||
The LaTeX document preparation system has an interesting history. When programmer Don Knuth wrote his first book, The Art of Computer Programming, in 1968, it was produced using an old-style printing press method. When he published the second edition in 1976, the publisher had moved to modern phototypesetting.
|
||||
|
||||
Knuth was unhappy with how the new edition looked. Addressing the problem from a programmer's perspective, Knuth decided to create his own text processing system so his future books could be formatted to look the same way, for every book in the series. And so it was that Don Knuth wrote the first version of TeX in 1978.
|
||||
|
||||
A few years later, Leslie Lamport created a set of macros that help authors write complex documents more easily. Lamport's macro extensions, LaTeX, essentially extends TeX to easily produce all kinds of documents. For example, many academic organizations use LaTeX to publish journals and proceedings.
|
||||
|
||||
### Writing documents in LaTeX
|
||||
|
||||
It's easy to learn the basics of LaTeX by writing a short article. Let's start by borrowing from the [About Opensource.com][4] page to create this sample input file:
|
||||
|
||||
```
|
||||
$ cat about.tex
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
|
||||
Opensource.com is a premier, daily publication focused on
|
||||
open source and Linux tutorials, stories, and resources.
|
||||
|
||||
We're a diverse and inviting group, made up of staff
|
||||
editors, Correspondents, contributors, and readers. We
|
||||
value differences in skills, talents, backgrounds, and
|
||||
experiences. There are a few different ways to get involved
|
||||
as a reader or a writer.
|
||||
|
||||
\end{document}
|
||||
```
|
||||
|
||||
Like other document formatting programs, LaTeX collects words and fills paragraphs. That means you can add new text in the middle of a paragraph and not worry about how the final document will look. As long as you don't add a blank line in the middle of a paragraph, LaTeX creates fully justified paragraphs. When it finds a blank line, LaTeX starts a new paragraph.
|
||||
|
||||
LaTeX needs a few control statements to define the document. Every LaTeX document should start with a declaration of the document's *class*. LaTeX supports several kinds of documents, including letters, books, and articles. For this example, I used `\documentclass{article}` to set the *article* class.
|
||||
|
||||
Tell LaTeX where the text begins and ends with the `\begin{document}` and `\end{document}` statements. If you add text before the `\begin{document}`, LaTeX generates an error. Any text after `\end{document}` is ignored.
|
||||
|
||||
Process this document using LaTeX with the `latex` command:
|
||||
|
||||
```
|
||||
$ latex about.tex
|
||||
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=latex)
|
||||
restricted \write18 enabled.
|
||||
entering extended mode
|
||||
(./about.tex
|
||||
LaTeX2e <2020-10-01> patch level 4
|
||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
|
||||
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
|
||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
|
||||
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-dvips.def)
|
||||
No file about.aux.
|
||||
[1] (./about.aux) )
|
||||
Output written on about.dvi (1 page, 736 bytes).
|
||||
Transcript written on about.log.
|
||||
```
|
||||
|
||||
LaTeX produces a lot of text so you can see what it is doing. If your document contains errors, LaTeX prints a message, and possibly prompt for what it should do. In most cases, you can type `exit` at the prompt to force LaTeX to quit.
|
||||
|
||||
If LaTeX was successful in generating a document, it produces a file with a `.dvi` extension. The *DVI* stands for *Device Independent* because you can use a variety of tools to create other kinds of output. For example, the **dvipdf** program converts the DVI file to a PDF file.
|
||||
|
||||
```
|
||||
$ dvipdf about.dvi
|
||||
```
|
||||
|
||||
![LaTeX output][5]
|
||||
|
||||
### Adding lists
|
||||
|
||||
LaTeX supports two kinds of lists: an *enumerated* list where each item starts with a number, and an *itemized* or "bullet" list. Add a short enumerated list after the second paragraph to list the ways that folks can get involved with Opensource.com:
|
||||
|
||||
```
|
||||
\begin{enumerate}
|
||||
\item Be a writer
|
||||
\item Be a reader
|
||||
\end{enumerate}
|
||||
```
|
||||
|
||||
Similar to how you need to provide `\begin` and `\end` statements around a document definition, you also need to provide `\begin` and `\end` statements around a list. Within the list, start each new item with an `\item` command. When you process this new file with LaTeX and convert it to PDF format, you see your list formatted as a numbered list:
|
||||
|
||||
![LaTeX output][6]
|
||||
|
||||
You can also add lists within a list. This is a neat feature if you need to provide a list with several options for each item. For example, you can add a few different resources for folks who want to become writers at Opensource.com. The embedded list uses its own `\begin` and `\end` statements. I'll add some extra space around this example so it's easier to see, but LaTeX doesn't really care about the blank lines and extra spaces:
|
||||
|
||||
```
|
||||
\begin{enumerate}
|
||||
\item Be a writer
|
||||
|
||||
\begin{itemize}
|
||||
\item Resources for writers
|
||||
\item Contributor Club
|
||||
\item Correspondent Program
|
||||
\end{itemize}
|
||||
|
||||
\item Be a reader
|
||||
\end{enumerate}
|
||||
```
|
||||
|
||||
The new list is inserted as an embedded list inside item number 1 because you added the list between the two original `\item` statements. You could have instead inserted this list after item number 2 by adding the new list before the `\end{enumerate}` statement.
|
||||
|
||||
![LaTeX output][7]
|
||||
|
||||
### Sections and subsections
|
||||
|
||||
You can make a long document easier to read by breaking it up into sections. To add a section title to a LaTeX document, use the `\section{...}` statement, and write the section's title inside the braces. For example, you can add a new section titled "About Opensource.com" to the top of the document with this:
|
||||
|
||||
```
|
||||
$ head about.tex
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
|
||||
\section{About Opensource.com}
|
||||
|
||||
Opensource.com is a premier, daily publication focused on
|
||||
open source and Linux tutorials, stories, and resources.
|
||||
|
||||
We're a diverse and inviting group, made up of staff
|
||||
editors, Correspondents, contributors, and readers. We
|
||||
```
|
||||
|
||||
The *article* document class adds a number before each major section, and increases the font size so it stands out in the document.
|
||||
|
||||
![LaTeX output][8]
|
||||
|
||||
For documents that require more organization, you can add subsections using the `\subsection{...}` command. Like the `\section{...}` command, enter the subsection's title between the curly braces.
|
||||
|
||||
```
|
||||
$ head about.tex
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
|
||||
\section{About Opensource.com}
|
||||
|
||||
Opensource.com is a premier, daily publication focused on
|
||||
open source and Linux tutorials, stories, and resources.
|
||||
|
||||
\subsection{Welcome to the Opensource.com community}
|
||||
```
|
||||
|
||||
![LaTeX output][9]
|
||||
|
||||
### Title and author
|
||||
|
||||
Scientific articles meant for publication require a title, author, and publication date. LaTeX provides a method to add this information by inserting commands that define each, then generates the article's title with a separate `\maketitle` command.
|
||||
|
||||
Add "About Us" as the article's title, "Opensource.com Editors" for the author, and "July 10, 2022" as the publication date. You must enter this block after the `\begin{document}` and before the rest of the content, such as the first section:
|
||||
|
||||
```
|
||||
\title{About Us}
|
||||
\author{Opensource.com Editors}
|
||||
\date{July 10, 2022}
|
||||
\maketitle
|
||||
```
|
||||
|
||||
When you process the document, LaTeX adds the title, author, and date to the top of the artcle:
|
||||
|
||||
![LaTeX output][10]
|
||||
|
||||
### Adding emphasis
|
||||
|
||||
Scientific and other technical documents often include terms and phrases that need to carry special emphasis. LaTeX provides several font effects you can use in technical documents, including emphasis text (usually displayed in italics), bold text, and small caps.
|
||||
|
||||
Update your LaTeX document to put the phrase "staff editors, Correspondents, contributors, and readers" in italics text, and the specific words "reader" and "writer" later in the paragraph in emphasis text. You can also put the phrase "skills, talents, backgrounds, and experiences" in bold. And while it's not the correct way to style it, you can use small caps to type "Linux."
|
||||
|
||||
```
|
||||
$ head -20 about.tex
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
|
||||
\title{About Us}
|
||||
\author{Opensource.com Editors}
|
||||
\date{July 10, 2022}
|
||||
\maketitle
|
||||
|
||||
\section{About Opensource.com}
|
||||
|
||||
Opensource.com is a premier, daily publication focused on
|
||||
open source and \textsc{Linux} tutorials, stories, and resources.
|
||||
|
||||
\subsection{Welcome to the Opensource.com community}
|
||||
|
||||
We're a diverse and inviting group, made up of \textit{staff
|
||||
editors, Correspondents, contributors, and readers}. We
|
||||
value differences in \textbf{skills, talents, backgrounds, and
|
||||
experiences}. There are a few different ways to get involved
|
||||
as a \emph{reader} or a \emph{writer}.
|
||||
```
|
||||
|
||||
This sample shows different ways to apply different styles to text. When you need to add emphasis, use the `\emph{...}` command, with the word or phrase between the curly braces. To display text in italics, boldface, or small caps, use a variation of the `\text` command: `\textit{...}` for italics, `\textbf{...}` for boldface, and `\textsc{...}` for small caps. LaTeX supports lots of other ways to style text, but these styles get you pretty far in writing scientific documents.
|
||||
|
||||
![LaTeX output][11]
|
||||
|
||||
### Using LaTeX
|
||||
|
||||
I've only touched on a few ways to write scientific and technical documents in LaTeX. Depending on your needs, you can also use LaTeX to insert footnotes and typeset mathematical equations and expressions. To explore other ways to use LaTeX for scientific writing, also read [A introduction to creating documents in LaTeX][12] here on Opensource.com.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/8/pdf-latex
|
||||
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[Donkey](https://github.com/Donkey-Hao)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jim-hall
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/coffee_tea_laptop_computer_work_desk.png
|
||||
[2]: https://unsplash.com/@jonasleupe?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[3]: https://unsplash.com/s/photos/tea-cup-computer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[4]: https://opensource.com/about
|
||||
[5]: https://opensource.com/sites/default/files/2022-08/latex-output.jpg
|
||||
[6]: https://opensource.com/sites/default/files/2022-08/latex-output-list.jpg
|
||||
[7]: https://opensource.com/sites/default/files/2022-08/latex-output-list-2.jpg
|
||||
[8]: https://opensource.com/sites/default/files/2022-08/latex-output-heading.jpg
|
||||
[9]: https://opensource.com/sites/default/files/2022-08/latex-output-subheading.jpg
|
||||
[10]: https://opensource.com/sites/default/files/2022-08/latex-output-about.jpg
|
||||
[11]: https://opensource.com/sites/default/files/2022-08/latex-output-emphasis.jpg
|
||||
[12]: https://opensource.com/article/17/6/introduction-latex
|
231
translated/tech/20220810 Create beautiful PDFs in LaTeX.md
Normal file
231
translated/tech/20220810 Create beautiful PDFs in LaTeX.md
Normal file
@ -0,0 +1,231 @@
|
||||
[#]: subject: "Create beautiful PDFs in LaTeX"
|
||||
[#]: via: "https://opensource.com/article/22/8/pdf-latex"
|
||||
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "Donkey"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
|
||||
使用 LaTeX 创建优美的 PDF 文件
|
||||
======
|
||||
|
||||
使用 LaTeX 标记语言编写文件。
|
||||
|
||||
LaTeX 文件准备系统有一段有趣的历史。在 1968 年,程序员 Don Knuth 用一种老式印刷排版方式,撰写了他的第一本书《计算机程序设计艺术》。当他在 1976 年出版第二版书时,出版商已经转向现代照相排版技术。
|
||||
|
||||
Knuth 对新版本的外观不满意。他从程序员的角度解决问题,决定创建他自己的文字处理系统,这样以后他出版的书就可以以相同格式排版,拥有相同的外观。因此,Don Knuth 在 1978 年编写了第一版 TeX 。
|
||||
|
||||
几年后, Leslie Lamport 创建了一组宏定义,以便作者更容易编写复杂文档。Lamport 的宏定义扩展 LaTeX ,有效地扩展了 TeX 能够轻松创建各种文档。例如,许多学术组织使用 LaTeX 出版期刊和论文集。
|
||||
|
||||
### 使用 LaTeX 编写文档
|
||||
|
||||
通过写一些短文就可以很容易掌握 LaTeX 基础。让我们从 [Opensource.com][4] 介绍界面,根据该界面创建一个示例:
|
||||
|
||||
```
|
||||
$ cat about.tex
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
|
||||
Opensource.com is a premier, daily publication focused on
|
||||
open source and Linux tutorials, stories, and resources.
|
||||
|
||||
We're a diverse and inviting group, made up of staff
|
||||
editors, Correspondents, contributors, and readers. We
|
||||
value differences in skills, talents, backgrounds, and
|
||||
experiences. There are a few different ways to get involved
|
||||
as a reader or a writer.
|
||||
|
||||
\end{document}
|
||||
```
|
||||
|
||||
类似其他文档格式程序, LaTeX 收集关键词并填充段落 。这意味着你可以在段落中间添加新文本,而不用担心最终文档会成什么样。只要你不在段落中添加空行, LaTeX 就会创建完全对齐的段落。当它找到一个空行时, LaTeX 会开启一个新段落。
|
||||
|
||||
LaTeX 需要一些定义文档的控制语句。任何 LaTeX 文档应当以文档 `类别` 声明开始。LaTeX 支持多种文档,包括书信、书籍和文章。例如,我使用 `\documentclass{article}` 设置类别为 `文章` 。
|
||||
|
||||
使用 `\begin{document}` 和 `\end{document}` 声明来定义文本的开始和结束。如果你在 `\begin{document}` 前添加了文本,那么 LaTeX 会报错。在 `\end{document}` 之后的文本都会被忽略。
|
||||
|
||||
使用 `latex` 命令使用 LaTeX 处理文档:
|
||||
|
||||
```
|
||||
$ latex about.tex
|
||||
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=latex)
|
||||
restricted \write18 enabled.
|
||||
entering extended mode
|
||||
(./about.tex
|
||||
LaTeX2e <2020-10-01> patch level 4
|
||||
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
|
||||
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
|
||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
|
||||
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-dvips.def)
|
||||
No file about.aux.
|
||||
[1] (./about.aux) )
|
||||
Output written on about.dvi (1 page, 736 bytes).
|
||||
Transcript written on about.log.
|
||||
```
|
||||
|
||||
LaTeX 生成许多文本,这样你就可以知道它在干什么。若你的文档包含错误, LaTeX 会报错并提示它可以做什么。大多数情况下,你可以在提示后输入 `exit` 来强制退出 LaTeX 。
|
||||
|
||||
如果用 LaTeX 成功生成一个文档,会生成一个带 `.dvi` 后缀的文件。`DVI` 表示 `设备无关` (Device Independent),因为你可以使用不同的工具来生成其他格式。例如, **dvipdf** 程序将 DVI 文件转换为 PDF 文件。
|
||||
|
||||
```
|
||||
$ dvipdf about.dvi
|
||||
```
|
||||
|
||||
![LaTeX output][5]
|
||||
|
||||
### 添加列表
|
||||
|
||||
LaTeX 支持两种列表:一种以数字开头的 `枚举` 列表,一种 `逐项` 或“项目符号”列表。在第二段后添加一个简短的枚举列表,列出人们可以参与 Opensource.com 的方式:
|
||||
|
||||
```
|
||||
\begin{enumerate}
|
||||
\item Be a writer
|
||||
\item Be a reader
|
||||
\end{enumerate}
|
||||
```
|
||||
|
||||
与在文档定义中添加 `\begin` 和 `\end` 声明类似,你也需要在列表前后添加 `\begin` 和 `\end` 声明。在列表中,每个项目以 `\item` 命令开始。当你用 LaTeX 处理该文档并转换为 PDF 格式后,你会看到该列表为数字列表:
|
||||
|
||||
![LaTeX output][6]
|
||||
|
||||
你也可以在列表中嵌套列表。这是一个优雅的功能,如果你需要在列表中为每个条目添加选项。例如,你可以为想要在 Opensource.com 中成为作者的人们提供一些不同的资源。嵌入列表使用单独的 `\begin` 和 `\end` 声明。为了看起来方便,我在示例中添加了空行,但是 LaTeX 会忽略这些空行:
|
||||
|
||||
```
|
||||
\begin{enumerate}
|
||||
\item Be a writer
|
||||
|
||||
\begin{itemize}
|
||||
\item Resources for writers
|
||||
\item Contributor Club
|
||||
\item Correspondent Program
|
||||
\end{itemize}
|
||||
|
||||
\item Be a reader
|
||||
\end{enumerate}
|
||||
```
|
||||
|
||||
作为嵌套列表,新列表嵌入在编号 1 的项目中,因为你在原先的 `\item` 声明之间添加了列表。你可以通过在 `\end{enumerate}` 语句前添加新列表,作为编号 2 项目的嵌套列表。
|
||||
|
||||
![LaTeX output][7]
|
||||
|
||||
### 章节和小节
|
||||
|
||||
你可以将冗长文章分成多个章节,这样更易于阅读。使用 `\section{...}` 语句在大括号内添加章节标题。例如,你可以在文档顶部添加一个标题为 "关于 Opensourcecom" 的新章节:
|
||||
|
||||
```
|
||||
$ head about.tex
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
|
||||
\section{About Opensource.com}
|
||||
|
||||
Opensource.com is a premier, daily publication focused on
|
||||
open source and Linux tutorials, stories, and resources.
|
||||
|
||||
We're a diverse and inviting group, made up of staff
|
||||
editors, Correspondents, contributors, and readers. We
|
||||
```
|
||||
|
||||
使用 `article` 文档类在关键部分添加数字,并使字体变大来突出显示。
|
||||
|
||||
![LaTeX output][8]
|
||||
|
||||
你可以使用 `\subsection{...}` 命令,来组织文档。就像 `\section{...}` 命令一样,在大括号中输入副标题名称。
|
||||
|
||||
```
|
||||
$ head about.tex
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
|
||||
\section{About Opensource.com}
|
||||
|
||||
Opensource.com is a premier, daily publication focused on
|
||||
open source and Linux tutorials, stories, and resources.
|
||||
|
||||
\subsection{Welcome to the Opensource.com community}
|
||||
```
|
||||
|
||||
![LaTeX output][9]
|
||||
|
||||
### 标题和作者
|
||||
|
||||
科学类的文章需要标题、作者以及发表日期。LaTeX 提供了通过插入命令的方式来添加这些信息,然后使用单独的 `\maketitle` 命令生成文章的标题。
|
||||
|
||||
将 "About Us" 作为文章标题,作者为 "Opensource.com Editors" ,发表日期为 "July 10, 2022" 。你必须在 `\begin{document}` 之后,文章内容前插入这些内容。
|
||||
|
||||
```
|
||||
\title{About Us}
|
||||
\author{Opensource.com Editors}
|
||||
\date{July 10, 2022}
|
||||
\maketitle
|
||||
```
|
||||
|
||||
当你在生成文档时,LaTeX 会将标题、作者和日期添加到文章的顶部:
|
||||
|
||||
![LaTeX output][10]
|
||||
|
||||
### 着重强调
|
||||
|
||||
科学和其他技术类文章通常会突出术语和短语。 LaTeX 提供了几种可以在技术文档中使用的字体效果,包括强调文本(通常以斜体显示)、粗体文本和小型大写字母。
|
||||
|
||||
将短语“员工编辑、通讯员、贡献者和读者”放在斜体文本中,并将特定词“读者”和“作者”放在段落后面的强调文本中。你也可以将“技能、才能、背景和经验”加粗。虽然这不是正确的样式设置方式,但你可以使用小型大写字母来键入 "Linux" 。
|
||||
|
||||
```
|
||||
$ head -20 about.tex
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
|
||||
\title{About Us}
|
||||
\author{Opensource.com Editors}
|
||||
\date{July 10, 2022}
|
||||
\maketitle
|
||||
|
||||
\section{About Opensource.com}
|
||||
|
||||
Opensource.com is a premier, daily publication focused on
|
||||
open source and \textsc{Linux} tutorials, stories, and resources.
|
||||
|
||||
\subsection{Welcome to the Opensource.com community}
|
||||
|
||||
We're a diverse and inviting group, made up of \textit{staff
|
||||
editors, Correspondents, contributors, and readers}. We
|
||||
value differences in \textbf{skills, talents, backgrounds, and
|
||||
experiences}. There are a few different ways to get involved
|
||||
as a \emph{reader} or a \emph{writer}.
|
||||
```
|
||||
|
||||
该示例展示了不同样式的文本的应用方法。当你需要强调时,使用 `\emph{...}` 命令,将强调主题放在大括号内。要以斜体、粗体或小型大写字母显示文本,使用 `\text` 命令的变体:`\textit{...}` 用于斜体,`\textbf{...}` 用于粗体,以及 `\ textsc{...}` 用于小型大写字母。LaTeX 支持许多其他方式来设置文本样式,这些样式有助于你编写科学技术类文章。
|
||||
|
||||
![LaTeX output][11]
|
||||
|
||||
### 使用 LaTeX
|
||||
|
||||
我只是介绍了使用 LaTeX 撰写科学技术文章的几种方式。你也可以在 LaTeX 中添加脚注,进行数学公式和方程的排版,取决于你的需求。你也可以通过阅读 Opensource.com 中的文章 [《在 LaTeX 中创建文档的介绍》][12] ,了解使用 LaTeX 撰写科学技术文章的其他方式。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/8/pdf-latex
|
||||
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[Donkey](https://github.com/Donkey-Hao)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jim-hall
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/coffee_tea_laptop_computer_work_desk.png
|
||||
[2]: https://unsplash.com/@jonasleupe?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[3]: https://unsplash.com/s/photos/tea-cup-computer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[4]: https://opensource.com/about
|
||||
[5]: https://opensource.com/sites/default/files/2022-08/latex-output.jpg
|
||||
[6]: https://opensource.com/sites/default/files/2022-08/latex-output-list.jpg
|
||||
[7]: https://opensource.com/sites/default/files/2022-08/latex-output-list-2.jpg
|
||||
[8]: https://opensource.com/sites/default/files/2022-08/latex-output-heading.jpg
|
||||
[9]: https://opensource.com/sites/default/files/2022-08/latex-output-subheading.jpg
|
||||
[10]: https://opensource.com/sites/default/files/2022-08/latex-output-about.jpg
|
||||
[11]: https://opensource.com/sites/default/files/2022-08/latex-output-emphasis.jpg
|
||||
[12]: https://opensource.com/article/17/6/introduction-latex
|
Loading…
Reference in New Issue
Block a user