首页 > 其他分享 >LaTeX简单常用方法笔记,附模板

LaTeX简单常用方法笔记,附模板

时间:2022-11-17 10:00:52浏览次数:45  
标签:LaTeX begin end usepackage par 笔记 centering document 模板


简单用用吧,为了完成作业,3~5分太香了

具体用法可自行搜索

推荐LaTeX在线编辑器:

https://cn.overleaf.com/

标题:​\title{标题}​作者:​\author{作者}​学号:​\studentid{123}​正文:

\begin{document}
...内容...
\end{document}

制作首页:​\maketitle​​​;如果没有这个,你的author之类的信息是不会显示的
中文支持:

\usepackage{ctex} % 导入中文宏
摘要部分

中文摘要和关键词:

\begin{abstract}         %摘要部分
\small\centering这是一篇关于勾股定理的小论文。%\small 是使用缩小字体,\centering是使内容居中
\par\textbf{Keywords:} keyword1, keyword2, keyword3
\end{abstract}

LaTeX简单常用方法笔记,附模板_latex


英文摘要和关键词:

% 由于此时是中文环境,需要定义一个新的英文摘要
\newcommand{\enabstractname}{Abstract}
\newenvironment{enabstract}{%
\par\small
\noindent\mbox{}\hfill{\bfseries \enabstractname}\hfill\mbox{}\par
\vskip 2.5ex}{\par\vskip 2.5ex}
\begin{enabstract}
This is the abstract in English.
\centering
\textbf{Keywords:} Abstract, \LaTeXe, English
\end{enabstract}

LaTeX简单常用方法笔记,附模板_css_02

自动目录:

\tableofcontents  %表示目录部分开始
\p{勾股定理在古代} %目录的前缀页面都会自动排版不需要手动排版
\p{勾股定理的近代形式}
\addcontentsline{toc}{p}{参考文献} %用来添加文献的标准方式
\p{附录} %要写的附录

LaTeX简单常用方法笔记,附模板_lua_03

表格:

\begin{table}[htbp]
\centering
\begin{tabular}{|c|c|c|c|}
\hline
& \multicolumn{3}{|c|}{Overall classification results (\%)} \\
\hline
Descriptors & KTH & UCF sports & TV human interaction \\
\hline
Trajectory & 91.67 & 74.64 & 46.43 \\
HOG & 86.11 & 69.88 & 44.52 \\
MBH & 96.3 & 72.74 & 45.88 \\
\hline
\hline
Combined & 96.3 & 81.07 & 55.4 \\
\hline
\end{tabular}%
\caption{An example table}
\label{t1}%
\end{table}%

LaTeX简单常用方法笔记,附模板_lua_04


引用:​内容内容\cite{ref1}​​​、​​内容内容\citep{ref1}​

LaTeX简单常用方法笔记,附模板_latex_05

参考文献:

I always thought something was fundamentally wrong with the universe \citep{ref1}
\bibliographystyle{plain}
\bibliography{ref/references}


% 文献具体内容在 ref/references.bib 中,内容格式(BibTeX)如下:
@book{ref1,
title={The Hitchhiker's Guide to the Galaxy},
author={Adams, D.},
isbn={9781417642595},
url={http://books.google.com/books?id=W-xMPgAACAAJ},
year={1995},
publisher={San Val}
}

LaTeX简单常用方法笔记,附模板_html_06

章:​\chapter{名称}​小节:​\p{名称}​

亚节:​\subp{名称}​

三级标题:​\subsubp{三级标题}​

LaTeX简单常用方法笔记,附模板_html_07


另起一页:​\newpage​

插入图片:

\begin{figure}[h!]
\centering
\includegraphics[scale=1.7]{img/universe} % 图片文件img/universe.jpg
\caption{The Universe}
\label{fig:universe}
\end{figure}

LaTeX简单常用方法笔记,附模板_latex_08


标签:​\label{名称a}​​​,常与​​\ref{名称a}​​同用

伪代码:

先导入包:\usepackage[lined,boxed,commentsnumbered]{algorithm2e}
再添加代码:
\begin{algorithm}[H]
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next p\;
current p becomes this one\;
}{
go back to the beginning of current p\;
}
}
\caption{How to write algorithms 1}
\end{algorithm}

LaTeX简单常用方法笔记,附模板_latex_09


导入其他tex:​\input{a.tex}​目录:​\makecontents​

各种列表:​\listtables、\listfigures、\listalgorithms​

设置页码:

\pagenumbering{arabic} %  阿拉伯数字
\setcounter{page}{1} % 数字1

LaTeX简单常用方法笔记,附模板_html_10


简单公式:

行内公式:
$ c = \sqrt{a^{2}+b_{0}^{2}+e^{x}} $
行间公式:
$$ c = \sqrt{a^{2}+b_{0}^{2} +e^{x}} $$


常用数学公式代码:
xfxuezhang.cn/index.php/archives/121

LaTeX简单常用方法笔记,附模板_latex_11


复杂公式并自动编号:

\begin{equation}
\mathbf{X} = \left(\begin{array}{ccc}
x_{11} & x_{12} & \ldots \\
x_{21} & x_{22} & \ldots \\
\vdots & \vdots & \ddots \end{array} \right)
\end{equation}

LaTeX简单常用方法笔记,附模板_latex_12


换行:​\\​空格:​\​

完整测试实例(仅供参考啊,实际有很多配置的):

% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode


\documentclass[11pt]{article} % use larger type; default would be 10pt
%\documentclass[master,twoside]{article}
\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)


%%% PAGE DIMENSIONS
\usepackage{geometry} % to change the page dimensions
\geometry{a4paper} % or letterpaper (US) or a5paper or....
% \geometry{margin=2in} % for example, change the margins to 2 inches all round
% \geometry{landscape} % set up the page for landscape
% read geometry.pdf for detailed page layout information


% 导入中文宏 eabstract
\usepackage{ctex}
\usepackage{graphicx} % support the \includegraphics command and options
\usepackage{natbib}
% \usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent


% 算法以及列表环境
\RequirePackage{cases,listings}
\RequirePackage{fancyvrb}
\RequirePackage{algorithmic}


%%% PACKAGES
\usepackage[lined,boxed,commentsnumbered]{algorithm2e}
\usepackage{booktabs} % for much better looking tables
\usepackage{array} % for better arrays (eg matrices) in maths
\usepackage{paralist} % very flexible & customisable lists (eg. enumerate/itemize, etc.)
\usepackage{verbatim} % adds environment for commenting out blocks of text & for better verbatim
\usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float
% These packages are all incorporated in the memoir class to one degree or another...


%%% HEADERS & FOOTERS
\usepackage{fancyhdr} % This should be set AFTER setting up the page geometry
\pagestyle{fancy} % options: empty , plain , fancy
\renewcommand{\headrulewidth}{0pt} % customise the layout...
\lhead{}\chead{}\rhead{}
\lfoot{}\cfoot{\thepage}\rfoot{}


%%% SECTION TITLE APPEARANCE
\usepackage{sectsty}
\allpsfont{\sffamily\mdseries\upshape} % (See the fntguide.pdf for font help)
% (This matches ConTeXt defaults)


%%% ToC (table of contents) APPEARANCE
\usepackage[nottoc,notlof,notlot]{tocbibind} % Put the bibliography in the ToC
\usepackage[titles,subfigure]{tocloft} % Alter the style of the Table of Contents
\renewcommand{\cftsecfont}{\rmfamily\mdseries\upshape}
\renewcommand{\cftsecpagefont}{\rmfamily\mdseries\upshape} % No bold!


%%% END Article customizations








%%% The "real" document content comes below...


\title{Freshness optimization of dense relay cache network data based on edge computing}
\author{The Author}




\begin{document}
\maketitle




\begin{abstract} %摘要部分
\small\centering这是一篇关于勾股定理的小论文。%\small 是使用缩小字体,\centering是使内容居中
\par\textbf{Keywords:} keyword1, keyword2, keyword3
\end{abstract}


% 由于此时是中文环境,需要定义一个新的英文摘要
\newcommand{\enabstractname}{Abstract}
\newenvironment{enabstract}{%
\par\small
\noindent\mbox{}\hfill{\bfseries \enabstractname}\hfill\mbox{}\par
\vskip 2.5ex}{\par\vskip 2.5ex}
\begin{enabstract}
This is the abstract in English.
\centering
\textbf{Keywords:} Abstract, \LaTeXe, English
\end{enabstract}




\tableofcontents %表示目录部分开始
\p{勾股定理在古代} %目录的前缀页面都会自动排版不需要手动排版
\p{勾股定理的近代形式}
\addcontentsline{toc}{p}{参考文献} %用来添加文献的标准方式
\p{附录} %要写的附录




\p{First p}


Your text goes here.


\subp{A subp}
\subsubp{三级标题}


More text.


\begin{figure}[h!]
\centering
\includegraphics[scale=1.7]{img/universe}
\caption{The Universe}
\label{fig:universe}
\end{figure}




\begin{algorithm}[H]
\KwData{this text}
\KwResult{how to write algorithm with \LaTeX2e }
initialization\;
\While{not at end of this document}{
read current\;
\eIf{understand}{
go to next p\;
current p becomes this one\;
}{
go back to the beginning of current p\;
}
}
\caption{How to write algorithms 1}
\end{algorithm}








\p{Conclusion}
``I always thought something was fundamentally wrong with the universe'' \citep{ref1}




$ c = \sqrt{a^{2}+b_{0}^{2}+e^{x}} (1)$
$$ c = \sqrt{a^{2}+b_{0}^{2} +e^{x}} $$




\begin{equation}
\mathbf{X} = \left(\begin{array}{ccc}
x_{11} & x_{12} & \ldots \\
x_{21} & x_{22} & \ldots \\
\vdots & \vdots & \ddots \end{array} \right)
\end{equation}


\renewcommand\bibname{Reference}
\bibliographystyle{plain}
\bibliography{ref/references}


\end{document}

LaTeX简单常用方法笔记,附模板_markdown_13

LaTeX简单常用方法笔记,附模板_html_14

LaTeX简单常用方法笔记,附模板_markdown_15

标签:LaTeX,begin,end,usepackage,par,笔记,centering,document,模板
From: https://blog.51cto.com/xfxuezhang/5859851

相关文章

  • 第十四章读书笔记
    知识点归纳问题和解决思路SQL注入怎么实现?基本流程0)根据网站功能,猜测哪些地方可能存在注入(selectinsert注册updatedelete)1)判断是否存在注入点;and1=1考虑参数......
  • HCIA学习笔记四十:DHCP中继代理
    一、DHCPRelay组网场景• DHCPRelay组网场景如下图:把用户的上线请求报文转发给DHCPServer。二、DHCP Relay工作流程• DHCPRelay的工作流程:三、DHCPRelay实......
  • JVM入门笔记
    面试常见:请你谈谈你对JVM的理解?java8虚拟机和之前的变化更新?什么是OOM,什么是栈溢出StackOverFlowError?怎么分析?JVM的常用调优参数有哪些?内存快照如何抓取?怎么......
  • ES6之模板字符串
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><title>模板......
  • 【模板】多项式乘法 FFT
    postedon2022-08-0223:57:12|under模板|source膜拜,抄写problem\[c_k=\sum_{i+j=k}a_ib_j.\]\(a,b\)已知,要求\(O(n\logn)\)。prework:复数定义初中数学中......
  • 1010002504-软件工程基础Y-吕书海 实验二 结对项目报告模板 (1).docx
    《软件工程基础》上机实验报告撰写要求 一、 纸张与页面要求采用国际标准A4型打印纸或复印纸,纵向打印。封页和页面按照下面模板书写(正文为:小四宋体1.5倍行距,首行......
  • Javascript(笔记40) - ES6特性 - Map
    Javascript(笔记40)-ES6特性-MapMap ES6 提供了Map数据结构。它类似于对象,也是键值对集合。但是“键”的范围不限于字符串,各种类型的值(包括对象)都可以当作键。Map也实......
  • 1010002504-软件工程基础Y-实验一 吕书海个人项目报告模板
    《软件工程基础》上机实验报告撰写要求 一、 纸张与页面要求采用国际标准A4型打印纸或复印纸,纵向打印。封页和页面按照下面模板书写(正文为:小四宋体1.5倍行距)。图......
  • Spring Boot学习笔记(1/2)
    前言serverlet服务器端小程序,第一代javaweb开发技术,基于java实现了一套用于动态网站的APITomcat\Jetty\Undertow都是Servelet容器,用来管理Servelet类jsp在html页......
  • Spring MVC学习笔记(1/2)
    SpringMVCMVC框架SpringMVC常用组件SpringMVC项目浏览器发送一个请求,若请求地址与web.xml中配置的前端控制器(DispatcherServlet)的url-pattern相匹配,则该请求......