LaTeX极速教程

安装

win上安装

linux上安装

mac安装

参考
https://www.tug.org/mactex/index.html

编辑器的选择

推荐用免费开源跨平台的编辑器

vscode相关插件

在用latex的同时, 推荐用用markdown, Markdown终极教程

这里给出latex和markdown的相关插件
File --> Preference --> Extensions

LTeX是latex的拼写和语法检查插件, 非常实用

vscode相关配置

File --> Preference --> Settings --> Opening Settings

LaTeX\LaTeX 的配置参考

该配置文件它会自动运行bibtex, 为了保证参考文献不出现[?], 需要多运行两次, 保存就可以运行, 快捷键Ctrl +S, 不建议自动保存, 推荐没事就手动保存, 保证写代码和文档的Hits不断

{
    "extensions.ignoreRecommendations": true,
    // "editor.fontSize": 17,
    "workbench.activityBar.visible": false,
    // "workbench.startupEditor": "newUntitledFile",
    // "window.zoomLevel": 1,
    "editor.wordWrap": "on",
    "editor.cursorBlinking": "solid",
    "editor.wordWrapColumn": 80,
    "editor.wrappingIndent": "same",

	"workbench.colorCustomizations": {
	// 设置光标颜色
	"editorCursor.foreground": "#FF0000",},

    "spellright.latexSpellParameters": [
      "author",
      "title",
      "date",
      "chapter",
      "section\\*?",
      "subsection\\*?",
      "subsubsection\\*?",
      "part",
      "paragraph",
      "subparagraph",
      "text(rm|sf|tt|md|bf|up|it|sl|sc|normal)",
      "underline",
      "emph",
      "item",
      "footnote(text)?",
      "caption(of)?",
      "multicolumn",
      "href",
      "hyperref",
      "begin\\{frame\\}"
  ],

    "telemetry.enableCrashReporter": false,
    "telemetry.enableTelemetry": false,
    "latex-workshop.showContextMenu":true, //右键菜单 
    "latex-workshop.intellisense.package.enabled": true, //根据加载的包,自动完成命令或包 

    "latex-workshop.latex.recipes": [
  { // 含参考文献的编译
    "name": "xelatex -> bibtex",
    "tools": [
        "xelatex",
        "bibtex"
    ]
  }, 
  { // 用于没有参考文献的编译
    "name": "xelatex",
    "tools": [
        "xelatex"
    ]
  }
  ],
  "latex-workshop.latex.tools": [{
  "name": "latexmk",
  "command": "latexmk",
  "args": [
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "-pdf",
    "%DOC%"
  ]
  }, {
  "name": "xelatex",
  "command": "xelatex",
  "args": [
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "%DOC%"
  ]
  }, {
  "name": "pdflatex",
  "command": "pdflatex",
  "args": [
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "%DOC%"
  ]
  }, {
  "name": "bibtex",
  "command": "bibtex",
  "args": [
    "%DOCFILE%"
  ]
  }],
  "latex-workshop.view.pdf.viewer": "tab",
  "latex-workshop.latex.clean.fileTypes": [
  "*.aux",
  "*.bbl",
  "*.blg",
  "*.idx",
  "*.ind",
  "*.lof",
  "*.lot",
  "*.out",
  "*.toc",
  "*.acn",
  "*.acr",
  "*.alg",
  "*.glg",
  "*.glo",
  "*.gls",
  "*.ist",
  "*.fls",
  "*.log",
  "*.fdb_latexmk"
  ],
  "editor.minimap.enabled": false,
  "breadcrumbs.enabled": false,
  "spellright.language": [
    "English (American)"
  ],
  "spellright.documentTypes": [],
  "window.zoomLevel": 1,
  "diffEditor.ignoreTrimWhitespace": true,
  }

LaTeX模板

该模板可以跨平台支持, 如果该模板出现问题, 解决的办法

\documentclass[a4paper, 12pt, UTF8]{ctexart}

\usepackage{color,xcolor}

% \usepackage{showkeys}
% \usepackage[notref,notcite]{showkeys}
\usepackage[colorlinks,
            linkcolor=blue,
            anchorcolor=blue,
            citecolor=blue,
            ]{hyperref}
% \hypersetup{hidelinks} %隐藏链接的样式

\usepackage{listings}
\lstset{
    language = Python,
    breaklines=true,  %代码过长则换行
    escapeinside=``, 
    xleftmargin=1.5em,
    xrightmargin=0.5em,
    aboveskip=1em,
    % numbers=left, %行号在左侧显示
    numberstyle= \scriptsize,%行号字体
    basicstyle=\small,
    % stringstyle=\color{mauve},
    keywordstyle= \color{blue},%关键字颜色
    % commentstyle=\color{gray}, %注释颜色
    % frame=shadowbox, %用方框框住代码块 
    frame=single, %用方框框住代码块 
}
\usepackage{amssymb}
\usepackage{amsfonts}

\usepackage{geometry}
\geometry{a4paper,left=2cm,right=2cm,top=2cm,bottom=2cm}

\parskip 0.2cm
\parindent=2\ccwd
\makeatletter
\newcommand{\figcaption}{\def\@captype{figure}\caption}
\newcommand{\tabcaption}{\def\@captype{table}\caption}
\makeatother
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{amsthm}
\usepackage{bm}
\usepackage{amsrefs}
\usepackage{epstopdf}
\usepackage{epsfig}
\usepackage{lineno}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{cite}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{caption}
\usepackage{float}
\usepackage[rightcaption]{sidecap}
\usepackage{fancyhdr}
% \usepackage{mathbbold}
\usepackage{titlesec}
\DeclareMathOperator\dif{d\!}

\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}

\usepackage{titlesec}
\usepackage{titletoc}
% \titlecontents{section}[1.1cm]{\bf \large}
%{\contentslabel{2.5em}}{}{\titlerule*[0.5pc]
%{$\cdot$}\contentspage}

\newcommand{\xiaosi}{\fontsize{12pt}{18pt}\selectfont}
\newcommand{\xiaosan}{\fontsize{15pt}{\baselineskip}\selectfont}
%\renewcommand{\normalsize}{\xiaosi}

\makeatletter
\@addtoreset{equation}{section}
\makeatother

\renewcommand{\thefigure}{\thesection.\arabic{figure}}
\renewcommand{\thetable}{\thesection.\arabic{table}}
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\titleformat{\section}{\centering\zihao{3}\bf}{\, \thesection\,}{1em}{}
\titleformat{\subsection}{\zihao{-3}\bf}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\zihao{4}\bf}{\thesubsubsection}{1em}{}


\newtheorem{lemma}{引理}[section]
\newtheorem{theorem}{定理}[section]
\newtheorem{definition}{定义}[section]
\newtheorem{corollary}{推论}[section]
\newtheorem{proposition}{性质}[section]
\newtheorem{remark}{}[section]
\newtheorem{example}{}[section]
\newcommand{\bs}[1]{\boldsymbol{#1}}
\renewcommand{\proofname}{\bf{证明:}}

\makeatletter
\renewenvironment{proof}[1][\proofname]{\par%
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax%
\trivlist%
\item[\hskip\labelsep%
#1]\ignorespaces%
}{%
\popQED\endtrivlist\@endpefalse%
}
\makeatother

\newenvironment{innerproof}
 {\renewcommand{\qedsymbol}{}\proof}
 {\endproof}

 \title{我是题目菌}
 \author{作者菌}


\begin{document}

\maketitle
\tableofcontents
\newpage

\renewcommand{\thepage}{\arabic{page}}
\pagestyle{plain}
\pagenumbering{arabic}\setcounter{page}{1}
\thispagestyle{plain}

\xiaosi\songti

\section{我是大标题}
这是一个比较实用的latex模板
\subsection{小标题1}
这个模板可以自动生成中文书签和模板
\subsection{小标题2}
这个模板还可以自动生产参考文献, 

需要在该文件夹的目录下创建一个proposal.bib文件

\subsubsection{小小标题}
公式测试
\begin{equation}\label{11}
x + \theta = \beta
\end{equation}
上面的公式\eqref{11}

\cite{bibref}
\newpage
\bibliographystyle{plain}
\bibliography{proposal} 

\end{document} 

工具推荐