latex初学笔记

前言

近日,苦于word实在不会用的问题,我找到了一款免费的编辑神器——latex,虽然我现在还不太会用,有许多强大的功能还不知道,但我已经被我已知的少量latex功能震惊了。

安装

步骤一.在清华镜像开源站下载iso文件
步骤二.解压该文件后选择install-tl-windows.bat运行,或者选择install-tl-advanced.bat(这个可以自定义去掉一些不要的包)运行
步骤三.当然是选一个好的编辑器啦~

编辑器

我用的是gvim,再下载一个Vim-Latex插件。配置vimrc是一个非常痛苦的过程,这里就略去了。
这里展示一下效果:
效果图

学习笔记

\documentclass[12pt]{article}
\usepackage{ctex}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pdfpages}
\graphicspath{{figure/pics/},{figure/pdf/}}
\usepackage{xeCJK}
\usepackage{listings}
\usepackage{fontspec}
\usepackage[colorlinks,
            linkcolor=red,
            anchorcolor=blue,
            citecolor=green
            ]{hyperref}
\usepackage[dvipsnames, svgnames, x11names]{xcolor}
\newcommand{\con}{\fontspec{Consolas}}
\newcommand{\alg}{\fontspec{Algerian}}
\setCJKfamilyfont{hwhp}{华文琥珀}
\newcommand{\hwhp}{\CJKfamily{hwhp}}
\newfontfamily\tempus{Tempus Sans ITC}
\lstset{ %
  backgroundcolor=\color{white},   % choose the background color; you must add \usepackage{color} or \usepackage{xcolor}
  basicstyle=\con,            % the size of the fonts that are used for the code
  breakatwhitespace=false,         % sets if automatic breaks should only happen at whitespace
  breaklines=true,                 % sets automatic line breaking
  captionpos=b,                    % sets the caption-position to bottom
  commentstyle=\ttfamily\color{lightgray},    
                                   % comment style
  deletekeywords={},               % if you want to delete keywords from the given language
  escapeinside={},                 % if you want to add LaTeX within your code
  extendedchars=true,              % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
%  frame=single,                   % adds a frame around the code
  keepspaces=true,                 % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
  keywordstyle=\color{red},        % keyword style
  language=C++,                    % the language of the code
  morekeywords={},                 % if you want to add more keywords to the set
  numbers=left,                    % where to put the line-numbers; possible values are (none, left, right)
  numbersep=5pt,                   % how far the line-numbers are from the code
  numberstyle=\tiny\color{gray},   % the style that is used for the line-numbers
 % rulecolor=\color{white},        % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
  showspaces=false,                % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
  showstringspaces=false,          % underline spaces within strings only
  showtabs=false,                  % show tabs within strings adding particular underscores
  stepnumber=1,                    % the step between two line-numbers. If it's 1, each line will be numbered
  stringstyle=\color{Orange},      % string literal style
  tabsize=2,                       % sets default tabsize to 2 spaces
  title=\lstname                   % show the filename of files included with \lstinputlisting; also try caption instead of title
}

\title{\huge \kaishu latex学习笔记}
\author{罗旅洲}
\date{\today}
\begin{document}
	\maketitle
	\tableofcontents
	\section{取消缩进}
		\verb|\noindent|	\\
		\verb|\setlength{\parindent}{0pt}|
	\section{字体字号}
	
	\subsection{字体族系列设置}

	\textrm{Roman Family}

	\textsf{Sans serif Family}

	\texttt{Typewriter Famliy}

	{\rmfamily Roman Family}

	{\sffamily Sans serif Family}

	{\ttfamily Typewiter Family}

	\sffamily this is a way to set word type.

	\subsection{字体系列设置(粗细,宽度)}
	
	\textmd{Medium Series} \textbf{Boldface Series}

	{\mdseries Medium Series} {\bfseries Boldface Series}

	\subsection{字体形状(直立、斜体、伪斜体、小型大写)}

	\textup{Upright Shape}
	\textit{itshape Italic Shape }
	\textsl{slshape Slanted Shape}
	\textsc{Small Caps Shape}
	{\upshape Upright Shape}
	{\itshape Itallic Shape}
	{\slshape Slanted Shape}
	{\scshape Small Caps Shape}
	
	\subsection{字体大小}

	\noindent{\tiny	hello}\\
	{\scriptsize hello}\\
	{\footnotesize hello}\\
	{\small hello}\\
	{\large hello}\\
	{\Large 你好}\\
	{\LARGE hello}\\
	{\huge 你好}\\
	{\Huge hello}\\

	\subsection{中文字号设置}

	{\zihao{5} 罗旅洲}
	
	\subsection{中文字体}
	{\songti 宋体} \quad {\heiti 黑体} \quad {\fangsong 仿宋}	\quad {\kaishu 楷书} \quad{\hwhp 华文琥珀}

	\section{特殊字符}
	\subsection{空白符号}
	\noindent1.空行分段,多个空行等于一个\\
	2.英文中多个空格处理为一个空格,中文空格自动忽略\\
	3.汉字与其他字符的间距自动由XelaTex自动处理\\
	一个空格 \verb|\quad|  罗 \quad 旅洲\\
	两个空格 \verb|\qquad| 罗\qquad 旅洲\\
	0.5个空格 \verb|\enspace| 罗 \enspace 旅洲\\
	1/6个空格 \verb|\,|		罗\,旅洲
	\subsection{\LaTeX 控制符}
	\# \% \_{} \textbackslash
	
	\subsection{Tex 标志符号}
	\TeX{} \LaTeX{} \LaTeXe{}
	
	\subsection{引号}
	‘ ’ “ ” ' ' `` ''

	\subsection{连字符}
	- -- ---
	\section{插入图片}
	\LaTeX{}中的插图

	\includegraphics[scale=0.1]{uestc.png}\\
	\includegraphics[height=2cm]{uestc}\\
	\includegraphics[width=2cm]{uestc}\\
	\includegraphics[angle=45,height=0.1\textheight,width=0.1\textwidth]{uestc}\\

	\section{插入表格}
	\begin{tabular}{|l|c|c|p{2cm}|} %l左对齐 c居中对齐 r右对齐 p指定宽度
		\hline 
		算法	& 内容	& 时间复杂度 &优化	\\
		\hline \hline
		Floyed &所有点最短路 & O({$N^3$}) & 无	\\
		\hline
		dijsktra &单源最短路 & O({$N^2$}) & 单调队列优化至O({$N logN$})	\\
		\hline
		spfa &单源最短路	& O(玄学) & lll优化,slf优化	\\
		\hline
	\end{tabular}
	
	\section{插入pdf}
	\includepdf[pages={1,2}]{0401.pdf}

	\section{浮动体}
	\LaTeX{}中电子科技大学见图\ref{fig-uestc}:
	\begin{figure}[htbp]
		\centering
		\includegraphics[height=1cm]{uestc}
		\caption{\TeX 美丽的电子科技大学}\label{fig-uestc}
	\end{figure}

	\newpage	
	\LaTeX{}中htbp的使用说明见表\ref{1}:
	\begin{table}[htbp]
		\centering
		\caption{htbp含义表}
		\label{1}
		\begin{tabular}{|l|c|c|}
			\hline
			符号 &英文全称 &作用\\		\hline
			h &here &代码所在的上下文位置\\		\hline
			t &top &代码所在页面或之后页面的顶部\\		\hline
			b &bottom & 代码所在页面或之后页面的底部\\			\hline
			p &page &独立一页\\			\hline
			htbp & &允许各个位置\\			\hline
		\end{tabular}
	\end{table}	
\iffalse
	注释多行
\fi
	\section{数学公式}
	\subsection{行内公式}
	\subsubsection{美元符号}
	交换律是$a+b=b+a$
	\subsubsection{小括号}
	交换律是\(a+b=b+a\)
	\subsubsection{math环境}
	交换律是
		\begin{math}
			a+b=b+a
		\end{math}
	\subsection{上下标}
	$3x^{x^{20}+a_1+a_2}-e^x+(a_1)^2=0$
	\subsection{希腊字母}
	$\alpha$
	$\beta$
	$\gamma$
	$\pi$
	$\omega$
	$\Pi$
	$\Omega$
	\subsection{数学函数}
	$\log$
	$\sin$
	$\arccos$
	$\ln$
	$\sin^2 x+ \cos^2 x = 1$
	$\sqrt{x^2}$
	$log_2x$
	\subsection{分式}
	$1/2$	$\frac{1}{2}$  $\frac{1}{1+\frac{1}{x}}$
	\subsection{积分}
	$\int_{a}^{b}f(x)dx$
	\subsection{行间公式}
	\subsubsection{美元符号}
	交换律是$$a+b=b+a$$
	\subsubsection{中括号}
	交换律是\[a+b=b+a\]
	\subsubsection{displaymath环境}
	\begin{displaymath}
		a+b=b+a
	\end{displaymath}
	\subsubsection{自动编号公式equation环境}
	交换律见式\ref{eq:commutative}
	\begin{equation}
		a+b=b+a	
		\label{eq:commutative}
	\end{equation}
	\subsubsection{不编号公式equation*环境}
	\begin{equation*}
		a+b=b+a
	\end{equation*}
	

	\section{多行公式}
	\begin{gather}
		a+b=b+a\\
		a \times b = b \times a \\
		a \% b = c \notag
	\end{gather}
	\begin{gather*}
		a + b = b + a\\
		a \times b = b \times a
	\end{gather*}
	\begin{align}
		x&=t & x&= \cos t & x&=\sin t\\
		y&=2t & y&=\sin x & y&=\int t
	\end{align}
	\begin{equation}
		\begin{split}	%一个公式拆成多行
			\cos 2x &= \cos^2 x-\sin^2 x\\
			&=2\cos^2 x-1
		\end{split}
		D(x)=\begin{cases} %分段函数
			1, & \text{如果} x \in \mathbb{Q};\\
			0, & \text{如果} x \in \mathbb{R}\setminus\mathbb{Q}.
		\end{cases}
	\end{equation}
	
	\section{插入超链接}
	
	\url{2.pdf}
	\href{www.baidu.com}{百度}
\end{document}

用latex写作业

疫情期间还可以用latex写网课的作业,都不用另外去买纸和笔了😂
orz
在这里插入图片描述
写出来是不是非常漂亮呢?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值