文章目录

  • 1. 前言
  • 2. 关于字体
  • 3. Overleaf支持的字体
  • 4. 直接上代码!
    • 4.1. 做过的错误尝试
  • 5. 小结
  • 6. 参考文献

1. 前言

创作开始时间:2021年12月12日21:21:07

感觉用LaTeX很简单,因为Overleaf上的模板太多了,但是要精通LaTeX,感觉要掌握的东西太多。本文主要对LaTeX Beamer中的字体设置进行研究。

备注:
第4节:“直接上代码!”包含实例代码。可以直接跳到这一节查看。

2. 关于字体

LaTeX的字体属性有四种:

  • family
  • shape
  • series
  • size

其中family属性主要可以归为三类:

  • serif 有衬线字体
  • sans serif (也叫做roman)。无衬线字体
  • monospaced 等宽字体

对于中文来说,宋体属于serif 字体,而黑体、幼圆、雅黑则属于sans serif 字体。
而英文,常用的 serif 字体为Times New Roman,常用的 sans serif 字体为Arial,Tahoma。

参考:

  • https://baike.baidu.com/item/serif/4199080?fr=aladdin
  • https://en.wikibooks.org/wiki/LaTeX/Fonts
  • LaTeX字体属性及其在中文Beamer中的使用 https://lttt.vanabel.cn/2018/06/04/latexzitishuxingjiqizaizhongwenbeamerzhongdeshiyong.html 这个还挺详细的。值得一看

3. Overleaf支持的字体

首先,所有的字体:

  • Fontname https://mirror-hk.koddos.net/CTAN/info/fontname/fontname.pdf 这个是官方文档

overleaf支持的字体没有那么多,具体可见官网(也挺多了):

  • Which OTF or TTF fonts are supported via fontspec? https://es.overleaf.com/learn/latex/Questions/Which_OTF_or_TTF_fonts_are_supported_via_fontspec%3F

4. 直接上代码!

\documentclass[xcolor=dvipsnames,9pt]{beamer}% 使用theme
\usetheme{CambridgeUS}
\useinnertheme{circles}% 使用字体必备的包
\usepackage{fontspec}# 定义字体
\newfontfamily\chalkd{DejaVu Sans}# 设置beamer的字体
\setbeamerfont{normal text}{family=\chalkd,series=\mdseries}
\setbeamerfont{alerted text}{family=\chalkd,series=\bfseries}
\setbeamerfont{frametitle}{family=\chalkd,series=\bfseries}
% ,size={\fontsize{32}{36}}
\AtBeginDocument{\usebeamerfont{normal text}}\title[Example]{Just an example!}
\author[xxx]{xxx}
\date{9th Dec, 2021}\begin{document}
\begin{frame}\titlepage
\end{frame}\section{Hello world}\begin{frame}{Hello world now.}Hello world to every one.
\end{frame}
\end{document}

效果如下:

DejaVu Sans是一种无衬线字体。

换成:Alfios(一种有衬线字体,从https://es.overleaf.com/learn/latex/Questions/Which_OTF_or_TTF_fonts_are_supported_via_fontspec%3F oveleaf官网找的)之后,就变成了下面的样子:

4.1. 做过的错误尝试

  • 使用\setmainfont{font/Palatino.ttf}或者\setmainfont{palatino},貌似\setmainfont对Beamer没用。
  • 使用\setmainfont[ExternalLocation=font/]{POLYA.OTF}[Ligatures=TeX],没用
  • \defaultfontfeatures{Ligatures=TeX},没用
  • 使用overleaf官方提供的example:
\setromanfont{Times New Roman}
\setsansfont{Arial}
\setmonofont[Color={0019D4}]{Courier New}

也没用。

  • 还看了很多别的操作,试了下都没用。。。找到有用的还是费了不少时间的。

5. 小结

创作结束时间:

6. 参考文献

很多。

有用的:

  • latex - 如何使用\setbeamerfont 设置任何字体大小(例如 32pt)? https://www.coder.work/article/6681293
  • 参考别人的代码:
\usetheme{default}
\usepackage{mathpazo}
\usepackage{fontspec}
\setbeamertemplate{background canvas}{\includegraphics [width=\paperwidth]{blackboard_bk.pdf}}
\newfontfamily\chalkd{Chalkduster.ttf}
\newfontfamily\chalkb{Chalkboard.ttc}\setbeamerfont*{normal text}{family = \chalkd}
\setbeamerfont{alerted text}{family = \chalkd}
\setbeamerfont{structure}{family = \chalkd}
\setbeamerfont{title}{family = \chalkd, size = \Huge}\setbeamercolor{normal text}{fg=white}
\setbeamercolor{alerted text}{fg=yellow!80}
\setbeamercolor{structure}{fg=yellow!80}
\setbeamercolor{frametitle}{fg=white}
\setbeamercolor{title}{fg=white}
\setbeamertemplate{blocks}[shadow=false]
\setbeamercolor{block body}{fg=normal text.bg!90!black}
\setbeamercolor{block body example}{bg=normal text.bg!90!black}\setsansfont{Chalkduster.ttf}
%\setmonofont{Chalkduster.ttf}

关于setmainfont :

  • How to \setmainfont when “randomfont.ttf” is in different folder? https://tex.stackexchange.com/questions/230186/how-to-setmainfont-when-randomfont-ttf-is-in-different-folder
  • \setmainfont vs \fontspec https://tex.stackexchange.com/questions/352804/setmainfont-vs-fontspec

设置字体:

  • Setting beamer text font https://tex.stackexchange.com/questions/489207/setting-beamer-text-font
  • Changing fonts in the body in beamer [duplicate] https://tex.stackexchange.com/questions/419920/changing-fonts-in-the-body-in-beamer
  • How to enforce a font series in beamer for normal/default text? https://tex.stackexchange.com/questions/320223/how-to-enforce-a-font-series-in-beamer-for-normal-default-text
  • Beamer Font: Change its Size, Family and style By Admin August 18, 2021 https://latex-beamer.com/tutorials/beamer-font/
  • Beamer template setbeamerfont bfseries https://tex.stackexchange.com/questions/236450/beamer-template-setbeamerfont-bfseries
  • What are all the possible first arguments to \setbeamerfont? tex.stackexchange.com/questions/183052/what-are-all-the-possible-first-arguments-to-setbeamerfont
  • Using a TrueType font in LaTeX with XeTeX https://gordonlesti.com/using-a-truetype-font-in-latex-with-xetex/
  • How to change fontspec’s default options https://tex.stackexchange.com/questions/431585/how-to-change-fontspec-s-default-options
  • latex字体设置 https://blog.csdn.net/wkd22775/article/details/51778920
  • How to modify Beamer theme? https://tex.stackexchange.com/questions/433595/how-to-modify-beamer-theme

xelatex:

  • Getting started with XeLaTeX https://robjhyndman.com/hyndsight/xelatex/
  • How to Use Different Fonts on Overleaf https://hongtaoh.com/en/2020/11/13/overleaf-latex-fonts/
  • Toying with Fonts in LaTeX huisaddison.com/blog/fonts-in-latex.html
  • XeLaTeX https://es.overleaf.com/learn/latex/XeLaTeX#The_basics:_Times_New_Roman
  • How to choose a specific weight from a font family using fontspec and XeLaTeX https://tex.stackexchange.com/questions/62603/how-to-choose-a-specific-weight-from-a-font-family-using-fontspec-and-xelatex
  • How to define a new font family on Beamer? https://tex.stackexchange.com/questions/177317/how-to-define-a-new-font-family-on-beamer#comment410588_177317

官方文档:

  • The fontspec package https://mirror-hk.koddos.net/CTAN/macros/unicodetex/latex/fontspec/fontspec.pdf

【已解决】如何设置、更换LaTeX Beamer的字体?以及调整正文所使用的字体(如从Times New Roman改变为Arial)、定义字体大小等操作相关推荐

  1. (已解决)Texmaker 编译latex文件后预览PDF显示字体模糊

    问题: miktex + texmaker 编译后自带的PDF显示字体模糊,resolution不正常,仿佛在看90年代的论文-- 电脑系统 win10,浏览器和福昕阅读器看pdf是正常的,同一个la ...

  2. linux笔记本触屏方向反了,[已解决]如何设置触摸板上下滚屏反转(像mac一样,和windows是反的)...

    先用以下命令看设备id: xinput 我的 Synaptics 触摸板的 id 是 13,下面就以 13 为例. 用 xinput list-props 13 可以列出设备属性,有一项应该是这样: ...

  3. 【已解决】在Overleaf/latex环境编辑Elsevier -> JVCI模板,参考文献显示为问号/不显示参考文献的问题

    在overleaf平台打开Journal of Visual Communication and Image Representation(JVCI,爱思维尔旗下)期刊模板,参考文献显示为[?]的问题 ...

  4. (已解决)windows设置共享文件夹, 局域网其他电脑怎么都访问不了

    操作:cmd命令行敲俩行命令 ①net use * /del 注: 该操作删除之前连接的记录 ②net use \\DESKTOP-N9R9BDM\sharefile "123456&quo ...

  5. 已解决Auto-GPT本地部署正确设置谷歌Google浏览器配置

    已解决Auto-GPT本地部署时无法连接Google的问题和无法连接openai的问题抛出异常:SYSTEM: Command goodle returned:Error: [WinError 100 ...

  6. win8.1已阻止java_win8系统下打开java程序时出现应用程序已被安全设置阻止的解决方法...

    今天和大家分享一下win7系统下打开java程序时出现应用程序已被安全设置阻止问题的解决方法,在使用win7系统的过程中经常不知道如何去解决win7系统下打开java程序时出现应用程序已被安全设置阻止 ...

  7. java tm已被阻止_win7系统不能运行java提示“应用程序已被安全设置被阻止”的解决方法...

    无论谁在使用电脑的时候都可能会发现不能运行java提示"应用程序已被安全设置被阻止"的问题,不能运行java提示"应用程序已被安全设置被阻止"让用户们很苦恼,这 ...

  8. android 设置字体包 字体包导致字体偏移 字体内边距问题(已解决)

    字体包存放位置 设置字体包方法1:(全局字体包) import android.content.Context; import android.graphics.Typeface;import jav ...

  9. 已解决urllib模块设置代理ip

    已解决urllib模块设置代理ip 文章目录 报错代码 报错翻译 报错原因 解决方法 千人全栈VIP答疑群联系博主帮忙解决报错 报错代码 最近用urllib编写了一个简单的爬虫下载网上文件的代码,刚运 ...

最新文章

  1. puppeteer(headless chrome)实现网站登录
  2. MySQL数据库:触发器Trigger
  3. 2012百度之星冬季赛第二场第二题 消去游戏I
  4. iPhone4 FaceTime 联通官方教程
  5. 重装系统后恢复oracle数据
  6. 运行时错误7内存溢出_分别从运行时和GC的角度看JAVA8内存管理
  7. webbrowser 百度列表点击_百度信息流推广后台完整的实操流程分享
  8. 即将绝版!小米最经典旗舰降价甩,以后不会再有了
  9. Hive过滤脏数据的一些经验
  10. 2016年11月14日--SQL创建数据库、表-查、插、删、改
  11. 深入浅出计算机组成原理03:处理器
  12. 攻防世界逆向——key
  13. css中绝对定位与相对定位的区别
  14. 计算机网络暗地里范围,《计算机网络应用技术教程》期中试题.doc
  15. SoapUI接口测试实战
  16. 计算机网络安全技术期末试题,归纳计算机网络安全技术期末复习试题 doc
  17. utf8编码在线转换html,utf8 gb2312编码在线转换工具
  18. onenote打开闪退平板_ipad pro 11英寸。onenote闪退 无法使用
  19. Docker容器dockerfile简介
  20. npm install --save 、--save-dev 、-D、-S的区别详细解说

热门文章

  1. linux新建用户退格键(删除键)无法正常使用的问题总结
  2. 新浪微博 发微博消息的处理
  3. 2019第十届蓝桥杯——I.胖子迷宫
  4. 金蝶K3 SQL报表系列-委外未勾稽明细表金蝶K3 SQL报表系列-委外未勾稽明细表
  5. 儿子于靖洋15个月照片
  6. java单例模式(Holder模式美滋滋)
  7. 全国省市区数据库-拼音-首字母-经纬度-城市编码-邮编-简称-组合称
  8. svg学习之svg动画
  9. 一级计算机软件wps,计算机一级WPS
  10. js 事件回调函数的对象属性说明:clientX、screenX、offsetX、pageX