latex学习笔记_2

latex源文件的基本结构
一个latex文件分为导言区及正文区(文稿区)
在导言区可以用\documentclass{class}来引入一个文档类,例如article、book、report、letter类

在正文区用以下,输入环境

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

一个latex文件只能有一个document环境
%表示由此开始的一行都是注释,在任何地方都可以插入注释,方便于文档修改。
在导言区放置全局设置

\title{文章题目}
\author{作者}
\date{\today}%显示编辑文档的时间,today为今天

为了使导言区设置的题目等能正常显示,需要在正文区加上\maketitle

\documentclass{article}
\usepackage{ctex}
\title{题目}
\author{作者名字}
\date{\today}
\begin{document}
	\maketitle
	哈!
\end{document}

在letter类中没有\maketitle这个命令
f ( x ) f(x) f(x)来表示数学模式

\begin{document}
	\maketitle
	哈!
	let $f(x)$ be defined by the formula
	$f(x)=3x^2+x-1$
\end{document}

在这里插入图片描述
表 示 行 内 公 式 , 公 式 和 前 后 的 文 章 内 容 相 连 双 表示行内公式,公式和前后的文章内容相连 双 $表示行间公式,会将前后内容都隔开,公式单独一行。

\begin{document}
	\maketitle
	哈!
	
	let $f(x)$ be defined by the formula
	$$f(x)=3x^2+x-1$$chapter one
\end{document}

在这里插入图片描述
中文处理方法
首先检查在options的build中编译器是xelatex,editor中字体编码是UTF-8。
在导言区要引用一个宏包

\usepackage{ctex}
\documentclass{article}
%degree的定义
\newcommand\degree{^\circ}
\usepackage{ctex}
\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}

\begin{equation}
	AB^2=BC^2+AC^2
\end{equation}

title 和author处设置了字体 黑体及楷书
degree要在导言区自定义
可以看到引入了equation环境,这个环境用于产生带编号的行间公式。
在这里插入图片描述
latex的字体设置
在latex中,一个字体有五种属性

字体编码
正文字体编码:OT1、T1、EU1等
数学字体编码:OML、OMS、OMX等
字体族
罗马字体:笔画起始处有装饰
无衬线无衬线字体:笔画起始处无装饰
打字机字体:每个字符宽度相同,又称等宽字体

还有字体系列,字体形状及字体大小

在正文区可以声明字体族设置

\documentclass{article}

\usepackage{ctex}


\begin{document}
	%字体族设置(罗马字体、无衬线字体、打字机字体)
	\textrm{Roman Family} \textsf{Scan Serif Family}\texttt{Typewriter Family}
	{\rmfamily Roman Family} {\sffamily Scan Serif Family}{\ttfamily Typewriter Family}

	{\sffamily good morning }
	
	{\ttfamily good bye}

\end{document}

\textrm、\textsf、texttt是字体命令,{}括号里是该种字体的被作用内容
\rmfamily是字体声明,后面跟着起作用文字

	%字体系列设置(粗细、宽度)
	\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 楷书}
中文字体的\textbf{粗体}与\textit{斜体}

在这里插入图片描述
字体大小是相对于normal size设置的,在documentclass处可以设置normal size

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

在这里插入图片描述
为了使latex的正文和字体设置分离开来,可以在导言区就声明,然后正文区直接调用。

\documentclass{article}

\usepackage{ctex}
\newcommand{\myfont}{\textbf{\textsf{Fancy Text}}}

\begin{document}
	\myfont
\end{document}

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值