# 使用 LaTeX 和 TeXstudio 排版文档 | Linux 中国

（本文字数：4968，阅读时长大约：5 分钟）

LaTeX 是一个服务于高质量排版的文档准备系统。通常用于大量的技术和科学文档的排版。不过，你也可以使用 LaTex 排版各种形式的文档。教师可以编辑他们的考试和教学大纲，学生可以展示他们的论文和报告。这篇文章让你尝试使用 TeXstudio。TeXstudio 是一个便于编辑 LaTeX 文档的软件。

## 启动 TeXstudio

\$ texstudio
Install package 'texstudio' to provide command 'texstudio'? [N/y] y

## 你的第一份文档

LaTeX 命令通常以反斜杠 \ 开头，命令参数用大括号 {} 括起来。首先声明 documentclass 的类型。这个例子向你展示了该文档的类是一篇文章。

\documentclass{article}
\begin{document}
The Fedora Project is a project sponsored by Red Hat primarily to co-ordinate the development of the Linux-based Fedora operating system, operating with the vision that the project "creates a world where free culture is welcoming and widespread, collaboration is commonplace, and people control their content and devices". The Fedora Project was founded on 22 September 2003 when Red Hat decided to split Red Hat Linux into Red Hat Enterprise Linux (RHEL) and a community-based operating system, Fedora.
\end{document}

## 使用间距

\documentclass{article}
\begin{document}
\hspace{2.5cm} The four essential freedoms
\vspace{0.6cm}
A program is free software if the program's users have the 4 essential freedoms:
The freedom to run the program as you wish, for any purpose (freedom 0).\vspace{0.2cm}
The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.\vspace{0.2cm}
The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.
\end{document}

## 使用列表和格式

\documentclass{article}
\begin{document}
\hspace{2cm} {\huge The four essential freedoms}
\vspace{0.6cm}
\noindent {\large A program is free software if the program's users have the 4 essential freedoms}:
\begin{itemize}
\item \vspace{0.2cm}
\noindent \textbf{The freedom to run} the program as you wish, for any purpose \textit{(freedom 0)}. \vspace{0.2cm}
\item \noindent \textbf{The freedom to study} how the program works, and change it so it does your computing as you wish \textit{(freedom 1)}. Access to the source code is a precondition for this.\vspace{0.2cm}
\item \noindent \textbf{The freedom to distribute copies of your modified versions} to others \textit{(freedom 3)}. \tiny{By doing this you can give the whole community a chance to benefit from your changes.\underline{\textsc{ Access to the source code is a precondition for this.}}}
\end{itemize}
\end{document}

## 添加列、图像和链接

\includegraphics 命令将图像内联放置在文档中。（为简单起见，请将图形文件包含在与 LaTeX 源文件相同的目录中。）

\documentclass{article}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{hyperref}
\begin{document}
\textbf{GNU}
\vspace{1cm}
GNU is a recursive acronym for "GNU's Not Unix!", chosen because GNU's design is Unix-like, but differs from Unix by being free software and containing no Unix code.
Richard Stallman, the founder of the project, views GNU as a "technical means to a social end". Stallman has written about "the social aspects of software and how Free Software can create community and social justice." in his "Free Society" book.
\vspace{1cm}
\textbf{Some Projects}
\begin{multicols}{2}
Fedora
\url{https://getfedora.org}
\includegraphics[width=1cm]{fedora.png}
GNOME
\url{https://getfedora.org}
\includegraphics[width=1cm]{gnome.png}
\end{multicols}
\end{document}