LateX的基础学习

本文介绍了LaTeX的基本使用,包括在文本编辑器如TeXstudio、VSCode中的操作,如命令行编译、XeLaTeX编译、中文字符支持、字体设置、文档结构、表格制作、浮动对象和数学模式等内容。还提及了如何在逆向工程和三维重建背景下利用LaTeX进行文档编写。
摘要由CSDN通过智能技术生成

what can i say

 在text.tex中写下

\documentclass{article} 

\begin{document]

Hello \LaTeX. 

\end{document} 

关闭记事本,cmd中dir保存,用latex text.tex来编译,可以命令行慢慢编译,这可以做成bat文件

为什么不直接开始在texstudio里输入,这是在干什么

xelatex text.tex直接编译成pdf

这是bat批处理文件
latex test.tex 
dvipdfmx test.dvi 
del *.aux *.dvi *.log 

或者换成
xelatex test.tex 
dvipdfmx test.dvi 
del *.aux *.dvi *.log 

中文是UTF-8一定一定 documentclass后面加上方括号utf8也可以

winedit的用的不是UTF-8,所以,如果用winedit编辑的中文,要用txt另存成UTF-8的,才能用texstudio,否则会乱码

\documentclass{article} 

\usepackage{ctex}

\begin{document]

你好 \LaTeXe 。

\end{document} 

本人懒得下载studio,将直接用现有的vscode,输入上面的这个代码

%导言区 导言区:全局设置
\documentclass{article}%book, report, letter %就是你写的是哪一类的文章,论文,报告,信还是书
\title{My First Document}
\author{Nan Geng} 
\date{\today} 

%正文区(文稿区) 
\begin{document}
\maketitle 
Hello World! 

Let $f(x)$be defined by the formula
$f(x)=3x^2+x-1$.
%用$包围的内容,称为数学模式,想要隔一行,就直接enter一行
%可以$$,可以跳行居中,官网不建议$$...$$多行公式,推荐采用\[...\]的形式
\end {document}

letter中无maketitle

\\也可以实现空行

%导言区
\documentclass{article}%book, report, letter 
\usepackage{ctex}
\newcommand\degree{^\circ} 
\title{\heiti 杂谈勾股定理} 
\author{\kaishu 张三} 
\date{\today}

%正文区(文稿区)
\begin{document} 
\maketitle
勾股定理可以用现代语言表述如下:

直角三角形斜边的平方等于两腰的平方和。

可以用符号语言表述为:设直角三角形 $ABC$,其中 $\angle C=90\degree$,则有:
\begin{equation} %这个用于产生带编号的行间公式
AB^2=BC^2+AC^2. 
\end{equation} 
\end{document} 

直接按住ctrl然后点击ctex就可以查看ctex的文档 在文件夹texlive-----texmf-dist-----doc-----latex-----ctex-----ctex.pdf可找到这个手册

有一个lshort-zh 在cmd打开,是简单实用教程

字体

 

{\rmfamily Roman Family} {\sffamily Sans Serif Family} {\ttfamily Typewriter Family}

{\sffamily who you are? you find self on everyone around. take you as the same as others!}

{\ttfamily Are you wiser than others? definitely no.in some ways, may it is true. What can you achieve? a luxurious house? a brillilant car? an admirable career? who knows?}

%字体系列设置(粗细、宽度)

\textmd{Medium Series} \textbf{Boldface Series}

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

%字体形状(直立、斜体、伪斜体、小型大写)

\textup{Upright Shape} \textit{Italic Shape} \textsl{Slanted Shape} \textsc{Small Caps Shape}

{\upshape Upright Shape}{\itshape Italic Shape}{\s1shape Slanted Shape} {\scshape Small Caps Shape}

%中文字体

{\songti 宋体}\quad {\heiti 黑体}\quad{\fangsong 仿宋} \quad{\kaishu 楷书}

中文字体的\textbf{粗体}与\textit{斜体}

 

大小可以设置一个参照,在\documentclass[10pt]{article} 一般只有101112磅

LateX中不好大量了命令,所有一般是开头\newcommand {\myfont}{\textbf{\textsf{Fancy Text}}}

%字体大小
{\tiny               Hello}\\
{\scriptsize         Hello}\\
{\footnotesize       Hello}\\
{\small              Hello}\\
{\normalsize         Hello}\\
{\large              Hello}\\
{\Large              Hello}\\
{\LARGE              Hello}\\
{\huge               Hello}\\
{\Huge               Hello}\\

%中文字号设理命令
\zihao{5}你好!

 文档的基本结构

\begin{document}
    \section{引言}
    \section{实验方法}
    \section{实验结果}
    \subsection{数据}
    \subsection{图表}
    \subsubsection{实验条性}
    \subsubsectionj{交验过程}
    \subsection{结果分析}
    \section{结论}
    \section{致谢}
\end{document}

   \\可以另起一行, \par就是另起自然段

ctexset可以具体更改标题格式

\ctexset{
section = {
format+ = \zihao{-4} \heiti \raggedright,
name ={,、},
number = \chinese{section},
^PX^^la = l・°ex plus 0.2ex minus •蛇,
aftoakip. = l-0ex plus 0.2ex minus •与,
^toXX^m = \hspace{0pt}
},
subsection = {
format+ = \zihao{5} \heiti \raggedright.,
% name={\thesubsectioriA },
name =(,、},
number = \arabic{subsection},
fejgfsnasJslR = 1.0ex plus 0.2ex minus .蛇,
^ftSESkiR = l・0ex plus 0.2ex minus •蛇,
雌就砌照=\hspace{0pt}
}
} 

 按照章节生成文档大纲

 空白

\begin{document}
\section{空白符号}
Are you wiser than others? definitely
no. in some ways, may it is true. What can you achieve? a luxurious house? a brillilant car? an admirable career? who knows?

近年来,随着逆向工程和三维重建技术的发展和应用,获取现
实世界中物体的三维数据的方法越来越多的关注和研究,很多
研究机构和商业公司都陆续推出了自己的三维重建系统。

%空行分段,多个空行等同1个
%自动缩进,绝对不能使用空格代替
%英文中多个空格处理为1个空格,中文中空格将被忽略
1符的间距会自动由XeLaTeX处理
%禁止使用中文全角空格

有许多符号产生空白,具体可以查询文档

a\quadb %1em
a\qquadb %2em
a\,b %1/6em
a\thinspaceb %0.5em
a\enspaceb %空格
a~b  %硬空格
a\ b %空格
a\kern 1pc b
a\kern -1em b
a\hskip 1em b
a\hspace{35pt} b
a\hphantom{xyz}b %
a\hfill b %弹性

对于特殊符号前面加\即可,\是\textbackslash

排版符号不予显示

标志符号

\section{\TeX 标志符号}
%基本
\TeX{} \LaTeX{} \LaTeXe{}
% xltxtra宏包提供
\XeLaTeX

% texnames宏包提供
\AmSTeX{} \AmS-\LaTeX{}
\BibTeX{} \LuaTeX{}

% mflogo宏包提供
\METAFONT{} \MF{} \MP{}

引号` ' `` ''分别是‘ ’ “ ”

注意!!!usepackage中是graphicx,不是graphics

% 导言区:\usepackage{graphicx}
%语 法:\includegraphics{< 选项>]{<文件名>}
% 格式:EPS, PDF, PNG, JPEG, BMP
\usepackage{graphicx}
\graphicspath{{figures/},{pics/}} %图片在前目录下的
figures 目录
%正文区(文稿区)
\begin{document}
\LaTeX{}中的插图:
\includegraphics{lion.eps}
\includegraphics{mountain.jpg}
\includegraphics{oscilloscope.pdf}

可以指定图片大小

表格制作

可以使用excel2latex这个插件哦

\begin{document}
    \begin{tabular}{l | c | c | c | r|}%可以用|产生竖线
        \hline%产生横线,两个可以双横线
        姓名&语文&数学&外语&备注\\
        \hline 
        张三 & 87 & 100 & 93 & 优秀 \\
        \hline
        李四& 75 & 64 & 52 &社考另行通知\\
        \hline
        王二 & 80 & 82 & 78 & \\
        \hline
    \end{tabular}

\p\c什么的

浮动

figure就是浮动 

浮动体是为了排版更紧密,有的图片直接放文字下边会另起一页,浮动体就避免了这个问题

%正文区(文稿区)
\begin{document}
\LaTeX{}中\TeX系统的吉祥物--小狮子见图\ref{fig-lion}。%这里是为了实现交叉引用

\begin{figure}[htbp]%htbp就是允许各个位置引用,交叉引用?
    \centering
    \includegraphics[scale=0.3]{lion}插入图像
    \caption{\TeX系统的吉祥物--小狮}\label{fig-lion}%设置插图的标题,会自动进行编号
    %浮动体是为了排版更紧密,有的图片直接放文字下边会另起一页,浮动体就避免了这个问题    
\end{figure}


在\LaTeX{}中的表格:也可以使用表\label{tab-score}所示的表格%这里是为了实现交叉引用
\begin{table}[h]
    \centering
    \caption{考试成绩单}\label{tab-score}%设置表格的标题,会自动进行编号
    \begin{tabular}{l | c | c | c | r|}%可以用|产生竖线
            \hline%产生横线,两个可以双横线
            姓名&语文&数学&外语&备注\\
            \hline 
            张三 & 87 & 100 & 93 & 优秀 \\
            \hline
            李四& 75 & 64 & 52 &社考另行通知\\
            \hline
            王二 & 80 & 82 & 78 & \\
            \hline
    \end{tabular}

此处(here)——代码所在的上下文位置

t,页顶(top)——代码所在的页面或之后页面的顶部

b,页底(bottom)——代码所在的页面或之后页面的底部

p,独立一页(page)——浮动页面

Ctrl+T注释,Ctrl+U取消注释

数学模式

这个很少用于日常

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值