latex使用各种系统字体

问题描述

我们在使用latex写文档时,一般会使用中英文的默认字体,但是在某些特殊需求下,我们可能需要变换使用下其他字体,通常系统一般自带了很多字体,关于有哪些字体,可以打开Word,打开其中的字体选项,下拉列表中那么多,我们如何在latex中也很方便地使用,看下面

解决方案

首先确定一下你本机上存储字体的文件夹,然后查看你相中字体的信息,以Ubuntu为例,查看字体信息如下:
otfinfo -i /usr/share/fonts/TTF/FreeSans.ttf
输出如下:

Family:              FreeSans
Subfamily:           Regular
Full name:           FreeSans
PostScript name:     FreeSans
Version:             Version 0412.2268 
Unique ID:           GNU: FreeSans Normal: 2012
Manufacturer:        GNU
Vendor URL:          https://savannah.gnu.org/projects/freefont/
Copyright:           Copyright 2002, 2003, 2005, 2008, 2009, 2010, 2012 GNU Freefont contributors.
License URL:         http://www.gnu.org/copyleft/gpl.html
License Description: This computer font is part of GNU FreeFont.  It is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This font is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this font.  If not, see 
    http://www.gnu.org/licenses/

As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
Vendor ID:           GNU

使用上述结果中的Full nameFreeSans在latex文档头中进行设置,例如:

\documentclass{article}
\usepackage{fontspec,kantlipsum}
\setmainfont{FreeSans}
\begin{document}
\kant[1]
\end{document}

关键在于使用正确的字体名来设置你的latex文档头

当然,你也可以从网上搜索下载喜欢的其他字体,使用上述方法,在latex中使用该字体。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值