figure字体 latex_LaTeX字体设置(一)

该博客主要围绕LaTeX中文文档的字体设置展开,介绍了使用xetex/xelatex字体设定宏包进行字体配置,包括将系统字体映射为逻辑字体、设置正文字体、不同字体样式及大小,还涉及标题和定理名称中文化等内容,并给出了多个设置模板。

% xetex/xelatex 字体设定宏包

\ProvidesPackage{zhfontcfg}

\usepackage{fontspec,xunicode}

\defaultfontfeatures{Mapping=tex-text} %如果没有它,会有一些 tex 特殊字符无法正常使用,比如连字符。

% 中文断行

\XeTeXlinebreaklocale "zh"

\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt

%将系统字体名映射为逻辑字体名称,主要是为了维护的方便

\newcommand\fontnamehei{FZHeiTi}

\newcommand\fontnamesong{Adobe Song Std}

\newcommand\fontnamekai{FZKaiTi}

\newcommand\fontnamemono{DejaVu Sans Mono}

\newcommand\fontnameroman{Dustismo Roman}

%设置文档正文字体为宋体

\setmainfont[BoldFont=\fontnamehei]{\fontnamesong}

\setsansfont[BoldFont=\fontnamehei]{\fontnamekai}

\setmonofont{\fontnamemono}

%楷体

\newfontinstance\KAI{\fontnamekai}

\newcommand{\kai}[1]{{\KAI #1}}

%黑体

\newfontinstance\HEI{\fontnamehei}

\newcommand{\hei}[1]{{\HEI #1}}

%英文

\newfontinstance\ENF{\fontnameroman}

\newcommand{\en}[1]{\,{\ENF #1}\,}

\newcommand{\EN}{\,\ENF\,}

\setCJKmainfont 设置 CJK 主字体,也就是设置 \rmfamily 的 CJK 字体

\setCJKsansfont 设置 CJK 无衬线的字体,也就是设置 \sffamily 的 CJK 字体

\setCJKmonofont 设置 CJK 的等宽字体,也就是设置 \ttfamily 的 CJK 字体

latex_elements = {...'preamble': '''

\\usepackage{xeCJK}

\\usepackage{indentfirst}

\\setlength{\\parindent}{2em}

\\setCJKmainfont{WenQuanYi Zen Hei Sharp}

\\setCJKmonofont[Scale=0.9]{WenQuanYi Zen Hei Mono}

\\setCJKfamilyfont{song}{WenQuanYi Zen Hei}

\\setCJKfamilyfont{sf}{WenQuanYi Zen Hei}'''

\documentclass[11pt,a4paper]{article}

\usepackage{fontspec,xltxtra,xunicode}

\usepackage[slantfont,boldfont]{xeCJK}

\setCJKmainfont[BoldFont=Adobe Heiti Std,ItalicFont=Adobe Kaiti Std]{Adobe Song Std}

\setCJKsansfont{Adobe Heiti Std}

\setCJKmonofont{Adobe Fangsong Std}

\setCJKfamilyfont{song}{Adobe Song Std}

\setCJKfamilyfont{hei}{Adobe Heiti Std}

\setCJKfamilyfont{fangsong}{Adobe Fangsong Std}

\setCJKfamilyfont{kai}{Adobe Kaiti Std}

\title{\LaTeX中文博客模板}

\author{wangl393}

\date{\today}

\begin{document}

\maketitle

{默认效果 宋体}\\

{\bfseries 粗体效果 设置成黑体}\\

{\itshape 斜体效果 设置成楷体}\\

\CJKfamily{kai} CJKfamily为楷体效果\\

\CJKfamily{fangsong} CJKfamily为仿宋效果\\

\CJKfamily{hei} CJKfamily为黑体效果\\

\end{document}

最终版!!!

\documentclass[a4paper,twocolumn]{article} %两列

\usepackage{graphicx}%插图宏集

\usepackage{titletoc}%要调整章节标题在目录页中的格式,可以用titletoc宏包 title of contents

\usepackage{titlesec} %其中 center 可使标题居中,还可设为 raggedleft (居左,默认),

%\usepackage{abstract}摘要分栏的宏包

\usepackage{fontspec, xunicode, xltxtra}

\usepackage{xeCJK}%中文字体

\setmainfont{Times New Roman}%缺省英文字体.serif是有衬线字体sans serif无衬线字体

\setCJKmainfont[ItalicFont={楷体}, BoldFont={黑体}]{宋体}%衬线字体 缺省中文字体为

\setCJKsansfont{黑体}

\setCJKmonofont{仿宋_GB2312}%中文等宽字体

%-----------------------xeCJK下设置中文字体------------------------------%

\setCJKfamilyfont{song}{SimSun} %宋体 song

\newcommand{\song}{\CJKfamily{song}}

\setCJKfamilyfont{fs}{FangSong_GB2312} %仿宋2312 fs

\newcommand{\fs}{\CJKfamily{fs}}

\setCJKfamilyfont{yh}{Microsoft YaHei} %微软雅黑 yh

\newcommand{\yh}{\CJKfamily{yh}}

\setCJKfamilyfont{hei}{SimHei} %黑体 hei

\newcommand{\hei}{\CJKfamily{hei}}

\setCJKfamilyfont{hwxh}{STXihei} %华文细黑 hwxh

\newcommand{\hwxh}{\CJKfamily{hwxh}}

\setCJKfamilyfont{asong}{Adobe Song Std} %Adobe 宋体 asong

\newcommand{\asong}{\CJKfamily{asong}}

\setCJKfamilyfont{ahei}{Adobe Heiti Std} %Adobe 黑体 ahei

\newcommand{\ahei}{\CJKfamily{ahei}}

\setCJKfamilyfont{akai}{Adobe Kaiti Std} %Adobe 楷体 akai

\newcommand{\akai}{\CJKfamily{akai}}

%------------------------------设置字体大小------------------------%

\newcommand{\chuhao}{\fontsize{42pt}{\baselineskip}\selectfont} %初号

\newcommand{\xiaochuhao}{\fontsize{36pt}{\baselineskip}\selectfont} %小初号

\newcommand{\yihao}{\fontsize{28pt}{\baselineskip}\selectfont} %一号

\newcommand{\erhao}{\fontsize{21pt}{\baselineskip}\selectfont} %二号

\newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont} %小二号

\newcommand{\sanhao}{\fontsize{15.75pt}{\baselineskip}\selectfont} %三号

\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont} %四号

\newcommand{\xiaosihao}{\fontsize{12pt}{\baselineskip}\selectfont} %小四号

\newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont} %五号

\newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont} %小五号

\newcommand{\liuhao}{\fontsize{7.875pt}{\baselineskip}\selectfont} %六号

\newcommand{\qihao}{\fontsize{5.25pt}{\baselineskip}\selectfont} %七号

%------------------------------标题名称中文化-----------------------------%

\renewcommand\abstractname{\hei 摘\ 要}

\renewcommand\refname{\hei 参考文献}

\renewcommand\figurename{\hei 图}

\renewcommand\tablename{\hei 表}

%------------------------------定理名称中文化-----------------------------%

\newtheorem{dingyi}{\hei 定义~}[section]

\newtheorem{dingli}{\hei 定理~}[section]

\newtheorem{yinli}[dingli]{\hei 引理~}

\newtheorem{tuilun}[dingli]{\hei 推论~}

\newtheorem{mingti}[dingli]{\hei 命题~}

\newtheorem{lizi}{{例}}

\begin{document}

\title{高质量纹理重建中的遮蔽处理}

\author{Archie}

\date{}

%摘要单栏设置

\twocolumn[

\begin{@twocolumnfalse}

\maketitle%生成标题

\renewcommand{\abstractname} {} %不显示摘要名字

\begin{abstract}

\noindent %摘要无缩进

摘要正文

\end{abstract}

\renewcommand{\abstractname}{摘要}

\end{@twocolumnfalse}

]

正文

\section{楷体}

\ahei{A黑体}

\section{黑体}

\hei{黑体}

\end{document}

简单模板

\documentclass[a4paper]{ctexart}

\usepackage{xeCJK}

\usepackage{fontspec,xunicode,xltxtra}

\usepackage{titlesec}

\setmainfont{Times New Roman} %西文默认衬线字体(serif)

\setsansfont{Arial} %西文默认无衬线字体(sans serif)

\setmonofont{Courier New} %西文默认的等宽字体

\setCJKmainfont[ItalicFont={楷体}, BoldFont={黑体}]{宋体}

%-----------------------------------------中文字体

\setCJKfamilyfont{yh}{Microsoft YaHei} % 1.微软雅黑 yh

\newcommand{\yh}{\CJKfamily{yh}}

\newfontfamily\ls{LiSu} % 2.隶书 ls

%-----------------------------------------英文字体

\newfontfamily\cl{Consolas}

\begin{document}

I just 随便 \yh{打} \ls{几个} \cl{word}

\end{document}

### 如何在LaTeX设置图片内的文字字体样式和大小 为了在LaTeX设置图片内文字的字体样式和大小,通常有两种方法:种是在图形环境外定义全局样式;另种则是在具体插入图像时局部修改。 对于全局设定,在导言区加入特定包并配置基础字体属性是个有效途径。例如,使用`ctex`宏包支持中文环境下字体处理[^4]: ```tex % 导言区 \documentclass{article} \usepackage{ctex} \setCJKmainfont{SimSun} % 设置正文字体为宋体 ``` 当涉及到单独调整某张图表内部的文字特性时,则可以在`\caption`命令或是通过`overpic`等软件包来实现更精细控制。下面给出利用`caption`宏包自定义标题样式的实例[^1]: ```tex % 导言区加载必要的宏包 \usepackage[labelfont={bf,sf},textfont=it]{caption} % 正文部分应用 \begin{figure}[htbp] \centering \includegraphics[scale=0.5]{example-image-a} \captionsetup{font={small}} % 设定当前图注的小号字体 \caption{这是个带有特别格式化的图注例子。} \label{fig:sample} \end{figure} ``` 如果需要进步定制化,比如改变颜色、加粗或者其他效果,可以借助于低级命令如`\fontsize{}{}\selectfont`配合其他文本修饰指令完成复杂需求[^3]。 此外,针对XeLaTeX编译器用户来说,还可以直接指定系统中存在的TrueType或OpenType字体文件路径给整个文档或者单个元素使用[^2]: ```tex % 对于 XeLaTeX 用户适用 \setmainfont[Ligatures=TeX]{Times New Roman} ``` 以上就是关于如何在LaTeX环境中灵活调整图片及其描述性文字外观的方法概览。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值