LaTeX是为高质量的排版提供服务的文档准备系统。 通常用于许多技术文件和科学文件的排版。 但是,也可以使用LaTex来合成各种格式的文档。 教师可以编辑他们的考试和教学大纲,学生可以展示他们的论文和报告。 在这篇文章中,让我们使用TeXstudio吧。 TeXstudio是一个便于编辑LaTeX文档的软件。
如果使用的是
启动 TeXstudio
Fedora工作站,则启动软件管理,输入TeXstudio以搜索APP应用程序。 然后,选择在系统上安装并添加TeXstudio。 可以从软件管理中启动该程序,也可以像以前一样从概要中启动该软件。或者,如果使用的是终端,请输入texstudio。 如果没有安装软件包,系统将提示您安装它。 输入y开始安装。
$ texstudio
bash : Tex Studio :命令非基金.
安装软件包' tex studio '到提供命令' tex studio '? n/y是
你的第一份文档
LaTeX命令通常以反斜杠开头,命令参数放在大括号{}中。 首先声明文档类的类型。 这个例子显示了该文档的类是文章。然后,在声明文档类之后,用begin和end标记文档的开始和结束。 在这些命令之间,写下以下内容。
文档类{ article }
begin {文档}
thefedoraprojectisaprojectsponsoredbyredhatprimarilytoco-ordinatethedevelopmentofthelinux-basedfedoraoperatingsystem, operatingwiththevisionthattheproject ' createsaworldwherefreecultureiswelcomingandwidespread,合作平台, andpeoplecontroltheircontentanddevices '.thefedoraprojectwasfoundedon 22 September 2003 whenredhatdecidedtosplitredhatlinuxintoro
结束文档
要创建
使用间距
段落分隔符,请在文本之间保留一个或多个换行符。 以下是包含四个段落的示例。
从这个例子可以看出,多个换行符不会在段落之间产生额外的空格。 但是,如果实际上需要额外的空间,请使用hspace和vspace命令。 这两个命令分别添加水平和垂直空间。 下面的代码示例显示了段落周围的附加空间。
文档类{ article }
begin {文档}
hspace { 2.5厘米} Thefouressentialfreedoms
vspace {0. 6厘米}
aprogramisfreesoftwareiftheprogram ' susershavethe 4基本地址3360
thefreedomtoruntheprogramasyouwish,foranypurpose (自由空间0.(vspace (0.2厘米) ) ) ) ) ) ) ) ) ) ) ) ) )
thefreedomtostudyhowtheprogramworks,andchangeitsoitdoesyourcomputingasyouwish (freedom1).accesstothesourcecodeisaprecondo
thefreedomtoredistributecopiessoyoucanhelpyourneighbour (自由空间2.(vspace ) 0.2厘米) )。
thefreedomtodistributecopiesofyourmodifiedversionstoothers (Freedom3).By doing this you can give the who
le community a chance to benefit from your changes. Access to the source code is a precondition for this. end{document}如果需要,你也可以使用 noindent命令来避免缩进。这里是上面 LaTeX 源码的结果:
使用列表和格式
如果把自由软件的四大基本自由列为一个清单,这个例子看起来会更好。通过在列表的开头使用begin{itemize},在末尾使用end{itemize}来设置列表结构。在每个项目前面加上item命令。
额外的格式也有助于使文本更具可读性。用于格式化的有用命令包括粗体、斜体、下划线、超大、大、小和 textsc 以帮助强调文本:
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 redistribute} copies so you can help your neighbour textit{(freedom 2)}.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}添加列、图像和链接
列、图像和链接有助于为文本添加更多信息。LaTeX 包含一些高级功能的函数作为宏包。usepackage命令加载宏包以便你可以使用这些功能。
例如,要使用图像,可以使用命令 usepackage{graphicx}。或者,要设置列和链接,请分别使用usepackage{multicol}和usepackage{hyperref}。
includegraphics命令将图像内联放置在文档中。(为简单起见,请将图形文件包含在与 LaTeX 源文件相同的目录中。)
下面是一个使用所有这些概念的示例。它还使用下载的两个 PNG 图片。试试你自己的图片,看看它们是如何工作的。
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}这里的功能只触及 LaTeX 功能的表面。你可以在该项目的帮助和文档站点了解更多关于它们的信息。
via: https://fedoramagazine.org/typeset-latex-texstudio-fedora/
作者:Julita Inca Chiroque选题:Chao-zhi译者:Chao-zhi校对:wxy
本文由 LCTT原创编译,Linux中国荣誉推出