LaTex基础知识

LaTex基础知识

基本结构

包括导言区正文区

% 导言区,保存一些参数及相关配置,引入一些包
\documentclass{article}%还可以有book,report,letter等
\title{My First Document}
\author{YG Zhou}
\date{\today}

%正文区
\begin{document}
    \maketitle  %输出标题、作者及日期
    Hello world!
    
    %增加一个空行即可实现换行功能
    Let $f(x)$ be defined by the formula$$f(x)=3x^2+x-1$$ which is a polynomial of degree 2.
\end{document}

注:latex中单 表 示 行 列 公 式 , 双 表示行列公式,双 表示行间公式

在这里插入图片描述

中文处理办法

保证utf-8编码,编译器为XeLaTex

其次使用以下命令:

\usepackage{ctex}

引入中文处理宏包,就可以加入中文内容

% 导言区,保存一些参数及相关配置,引入一些包
\documentclass{article}%还可以有book,report,letter等
\usepackage{ctex}
\title{\heiti 第一个LaTex文件}
\author{\kaishu YG Zhou}
\date{\today}

%正文区
\begin{document}
    \maketitle  %输出标题、作者及日期
    Hello world!
    
    %增加一个空行即可实现换行功能
    Let $f(x)$ be defined by the formula$$f(x)=3x^2+x-1$$ which is a polynomial of degree 2.
    \begin{equation}   %带序号的数学公式
    AB^2 = BC^2 + AC^2.
    \end{equation}
\end{document} 

效果为:
在这里插入图片描述

字体字号设置

在这里插入图片描述

    %字体族设置(罗马字体、无衬线字体、打字机字体)
    %可以使用字体命令,作用于命令的参数
    \textrm{Roman Family}  \textsf{Sans Serif Family} \texttt{Typewriter Family}
    %也可以使用字体声明作用于后续的文本(大括号进行分组,限定字体的作用范围)
    {\rmfamily Roman Family}  {\sffamily Sans Serif Family} {\ttfamily Typewriter Family}

效果:

在这里插入图片描述

    %字体系列设置(粗细、宽度)
    \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}
    {\slshape Slanted Shape}  {\scshape Small Caps Shape}
        
    %中文字体
    {\songti 宋体}  \quad {\heiti 黑体} \quad {fangsong 仿宋} \quad {\kaishu 楷书}

效果:
在这里插入图片描述

设置字号前,首先要在开头设置normal size 的大小

\documentclass[10pt]{article}  %设置normal size的大小为10磅  一般只有10、11、12
    %字体大小
    {\tiny          Hello}\\
    {\scriptsize    Hello}\\
    {\footnotesize  Hello}\\
    {\small         Hello}\\
    {\normalsize    Hello}\\
    {\large         Hello}\\
    {\Large         Hello}\\
    {\huge          Hello}\\
    {\Huge          Hello}\\
        
    %中文字号设置命令
    \zihao{5} 你好!

在这里插入图片描述

将众多设置集成为一个命令,需要声明新的命令

声明方式:

\newcommand{\myfont}{\textbf{\textsf{\textsl{Fancy Text}}}}
%声明的写法为\newcommand{}{}第一个打括号里写命令名称,第二个打括号里嵌套命令内容
%命令使用如下
    \myfont

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值