美文网首页
LaTex学习记录:基础入门

LaTex学习记录:基础入门

作者: 離枝 | 来源:发表于2018-04-06 17:24 被阅读0次

效果展示

下载和安装

总结:
1. 选择 TeX 发行版(windows下有MiKTeX or proTeXt or TeX Live等选择)
2. 选择LaTeX 编辑器(有Texpad、TexStudio、ShareLatex、WinEdit等)
√ Getting MiKTeX
√ TeXstudio

Getting LaTeX
Install MiKTeX on Windows
Manage your TeX installation with MiKTeX Console

快速入门

LaTeX introduction / Quick-start guide
在线LaTex范例对照
Sandbox

一个最简单的例子

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc} % Unicode support (Umlauts etc.)
\begin{document}
    \title{Example}
    \author{HJ}
    \date{\today{}}
    \maketitle
    \section{title}
    content...
\end{document}
显示效果

解读:
documentclass 有article,report,letter,book,slides,proc,exam,leaflet等等类型
What are the available “documentclass” types and their uses?
usepackage 有amsmath,inputenc,hyperref,graphicx,listings等等选择
WikiBooks: LaTeX/Package Reference
preamble A document in LaTeX consists of two parts, the preamble and the main document. \begin{document} marks the end of the preamble and the beginning of the actual document. 简言之,preamble就是设置documentclass的类型和packages的部分。 \begin{document} 是main document和preamble的分界线。
LaTeX Wiki:LaTeX preamble
Best practice on organising your preamble
command command可以有arguments,放在curly braces或者square brackets中
\command[optional argument]{argument}
Arguments in curly braces are mandatory, while in square brackets are optional.
LaTeX environment An environment begins with the begin command, and ends with the end command.
LaTex Wiki: LaTeX environment
ShareLaTex:Environments
LaTex Wiki: List of LaTeX environments
Latex Standard Environments

LaTex中environments举例

复杂一点的例子

\documentclass[a4paper,11pt]{article}
\usepackage{amsmath} % align环境需要导入该包
\usepackage{listings} % Source code formatting and highlighting
\usepackage{xeCJK} % 用来显示中文的package,在TexStudio中要把build模式改成XeLaTex方式,否则会报错
\begin{document}
    \title{LaTex学习记录:基础入门}
    \author{离枝}
    \date{\today{}}
    \maketitle
    \tableofcontents
    \section{Section1}
    \subsection{Subsection1}
    content...  \LaTeX

    It contains two paragraphs.% Here's a comment.
    \begin{align}
    f(x) &= x^2\\
    f'(x) &= 2x\\
    F(x) &= \int f(x)dx\\
    F(x) &= \frac{1}{3}x^3
    \end{align}
    
    \section{Section2}
    \subsection{Subsection2}
    \begin{lstlisting}[language={java},caption=,breaklines=true,frame=single]
public class HelloWorld {
    public static void main(String[] args) {
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello,World");
    }
}
    \end{lstlisting}
\end{document}
显示效果

此例中比第一个例子增加以下内容

  • 中文显示
    \usepackage{xeCJK}
  • 目录显示
    \tableofcontents
  • 数学公式显示及对齐
    \usepackage{amsmath}
    \begin{align}
    f(x) &= x^2\\
    f'(x) &= 2x\\
    F(x) &= \int f(x)dx\\
    F(x) &= \frac{1}{3}x^3
    \end{align}
  • 代码显示
    \usepackage{listings}
    \begin{lstlisting}[language={java},caption=,breaklines=true,frame=single]
public class HelloWorld {
    public static void main(String[] args) {
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello,World");
    }
}
    \end{lstlisting}

其中目录显示是通过\tableofcontentscommand自动生成的。数学公式的对齐,以及
编号是通过导入amsmathpackage并且使用alignenvironment生成的。代码块的生成是通过导入listingpackage并且使用 lstlisting生成的。如果需要生成高亮的代码块,则可以使用minted来实现。需要注意的是,在TexStudio中,如果导入xeCJKpackage,应当设置build环境为XeLaTex,否则会报错(默认为PdfLaTex)。

教程

知乎:手把手教你在Mac/Windows下搭建实用的LaTex编译环境以及其使用初步
从零开始 LaTeX 快速入门
学术写作利器——LaTeX入门笔记整理(不定期更新,附加使用心得)
A simple guide to LaTeX - Step by Step
一份其实很短的 LaTeX 入门文档

资源

清华大学开源软件镜像站
清华大学 LaTeX 模板
知乎:有哪些美观实用的或者有创意的 LaTeX 模板?
latextemplates
overleaf: templates
The Listings Package Manual

相关疑问及比较

知乎:有哪些好的 LaTeX 编辑器?
stackexchange:What are the advantages of TeX Live over MiKTeX?
TeX on Windows: TeX Live versus MiKTeX revisited
stackexchange:LaTeX Editors/IDEs
知乎:如何配置 Sublime Text 的 LaTeXTools?
stackoverflow:LaTeX package to do syntax highlighting of code in various languages
简书:Latex插入代码块
知乎:如何在texstudio中保留原格式粘贴?
PDF:在LaTex中输入中文
LaTex Sheet
如何在Latex中输入中文

相关文章

  • LaTex学习记录:基础入门

    效果展示 下载和安装 总结:1. 选择 TeX 发行版(windows下有MiKTeX or proTeXt or...

  • Latex 学习

    Latex 学习 @(05.2 Latex)[latex][基础教程] 这篇文章是关于latex基础教程.pdf的...

  • 学Python的009天

    原创:XIAO油菜花学习进度记录:《零基础入门学习Python》P17:序列!序列!《Python开发入门与爬虫项...

  • LaTeX入门三两事

    因为美赛需要学习LaTeX排版,于是开始学习LaTeX,一开始接触也遇到了一些困惑,相信很多新手入门也会如此。正好...

  • 学Python的014天

    原创:XIAO油菜花学习进度记录:《零基础入门学习Python》P23:函数:递归是什么《Python开发入门与爬...

  • 学Python的010天

    原创:XIAO油菜花学习进度记录:《零基础入门学习Python》P19:函数:灵活即强大《Python开发入门与爬...

  • 学Python的012天

    原创:XIAO油菜花学习进度记录:《零基础入门学习Python》P21:函数:内嵌函数和闭包《Python开发入门...

  • 学Python的020天

    原创:XIAO油菜花学习进度记录:《零基础入门学习Python》P30:文件:一个任务《Python开发入门与爬虫...

  • 学Python的016天

    原创:XIAO油菜花学习进度记录:《零基础入门学习Python》P25:字典:当索引不好用时《Python开发入门...

  • 学Python的015天

    原创:XIAO油菜花学习进度记录:《零基础入门学习Python》P25:递归:小兔子,汉诺塔《Python开发入门...

网友评论

      本文标题:LaTex学习记录:基础入门

      本文链接:https://www.haomeiwen.com/subject/rzplhftx.html