新博客地址: http://ssendeavour.github.io/
这个博客不再更新了。
文档地址:fontspec doc
fontspec
支持配置文件,文档里有详细的讲解,这里忽略。
\fontspec [<font features>] {<font name>} # one-time use
\setmainfont [<font features>] {<font name>}
\setsansfont [<font features>] {<font name>}
\setmonofont [<font features>] {<font name>}
\newfontfamily <cmd> [<font features>] {<font name>}
The font features
argument accepts comma separated <font feature>=<option>
lists;
这些命令也影响像\mathrm
这样的数学模式使用的字体。
\textbf
, \textit
命令)。根据字体文件名。在XeTeX中,TeX发行版自带的OpenType字体(如/usr/local/texlive/2013/texmf-dist/fonts/opentype/public
)只能通过文件名加载。LuaTeX没有这个问题。在默认搜索路径(包括当前目录)上的字体可以只指定文件名,不用指定完整目录。
通过文件名选择的字体必需显式的指定粗体和斜体。如:
\fontspec [ BoldFont = texgyrepagella-bold.otf , ItalicFont = texgyrepagella-italic.otf , BoldItalicFont = texgyrepagella-bolditalic.otf ] {texgyrepagella-regular.otf}
或者
\fontspec
[ Extension = .otf ,
BoldFont = texgyrepagella-bold ,
... ]
{texgyrepagella-regular}
或者
\fontspec
[ Extension = .otf ,
UprightFont = *-regular ,
BoldFont = *-bold ,
... ]
{texgyrepagella}
或者加载不在默认搜索路径的字体,指定path选项:
\fontspec
[ Path = /Users/will/Fonts/ ,
UprightFont = *-regular ,
BoldFont = *-bold ,
... ]
{texgyrepagella}
以下命令声明全文使用的字体,它们的参数与fontspec
命令相同。
\setmainfont [<font features>] {<font name>}
\setsansfont [<font features>] {<font name>}
\setmonofont [<font features>] {<font name>}
\newfontfamily \<font-switch> [<font features>] {<font name>}
\newfontface \<font-switch> [<font features>] {<font name>}
这允许我们使用字体A + 字体B的粗体 + 字体C的斜体这种组合。
BoldFont = <font name>
ItalicFont = <font name>
BoldItalicFont = <font name>
SlantedFont = <font name>
BoldSlantedFont = <font name>
SmallCapsFont = <font name>
示例:
\fontspec[BoldFont={Helvetica Neue}]
{Helvetica Neue UltraLight}
fontspec
宏包必需在其他数学字体宏包(如euler)之后载入。fontspec
不改变一般的数学,只影响upright和bold。要改变数学符号的字体,请使用mathspec
或者unicode-math
宏包
\setmathrm [<font features>] {<font name>}
\setmathsf [<font features>] {<font name>}
\setmathtt [<font features>] {<font name>}
\setboldmathrm [<font features>] {<font name>}
使用以上命令显式设置要在\mathrm
这样的命令中使用的字体。
例子:
\usepackage{mathpazo}
\usepackage{fontspec,xunicode}
\setmainfont{Optima}
\setmathrm{Optima}
\setboldmathrm[BoldFont={Optima ExtraBlack}]{Optima Bold}
可以使用配置文件创建全局的或者每个字体的font feature。
找到了这样一段话:
OpenType fonts (and other ‘smart’ font technologies such as AAT and Graphite) can change the appearance of text in many different ways. These changes are referred to as features. When the user applies a feature — for example, small capitals — to a run of text, the code inside the font makes appropriate adjustments and small capitals appear in place of lowercase letters. However, the use of such features does not affect the underlying text. In our small caps example, the lowercase letters are still stored in the document; only the appearance has been changed by the OpenType feature. This makes it possible to search and copy text without difficulty. If the user selected a different font that does not support small caps, the ‘plain’ lowercase letters would appear instead. Some OpenType features are required to support particular scripts, and these features
small caps, the ‘plain’ lowercase letters would appear instead. Some OpenType features are required to support particular scripts, and these features are often applied automatically. Other features can be applied to support a particular language.
A very large group of OpenType features is designed to support high quality typography in Latin, Greek, Cyrillic and other standard scripts.
详细的feature请参考 fontspec
说明文档的第10节。
feature按照逻辑功能分类。所有的分类如下(fontspec doc 第10节)
\defaultfontfeatures{<font features>}
\defaultfontfeatures[<font name>] {<font features>}
重复使用这两个命令新设置会覆盖旧的。 例子:
\defaultfontfeatures[TeX Gyre Adventor]{Color=blue}
\setmainfont{TeX Gyre Adventor}% will be blue
\addfontfeatures{<font features>}
例子:
\addfontfeature{Numbers=OldStyle}...
\addfontfeature{Numbers=Lining}...
例子中,两次改变同一个feature,结果如何,要看具体字体。作者说以后会实现新的配置覆盖旧的配置。
BoldFeatures{<features>}
ItalicFeatures{<features>}
BoldItalicFeatures{<features>}
SlantedFeatures{<features>}
BoldSlantedFeatures{<features>}
SmallCapsFeatures{<features>}
例子:
\fontspec[
UprightFeatures={Color = 220022,
SmallCapsFeatures = {Color=115511}},
ItalicFeatures={Color = 2244FF,
SmallCapsFeatures = {Color=112299}},
BoldFeatures={Color = FF4422,
SmallCapsFeatures = {Color=992211}},
BoldItalicFeatures={Color = 888844,
SmallCapsFeatures = {Color=444422}},
]{TeX Gyre Termes}
Upright {\scshape Small Caps}\\
\itshape Italic {\scshape Italic Small Caps}\\
\upshape\bfseries Bold {\scshape Bold Small Caps}\\
\itshape Bold Italic {\scshape Bold Italic Small Caps}
xcolor
宏包,也可以使用它定义的颜色名称。再往下都是些用处不大的东西了。不写了。
other \usefont{OT1}{cmr}{m}{n}
Written with StackEdit.
Android开发权威指南(SDK2.3)笔记
4种方法:
intent.putExtra(key, value)
。在接收方:getIntent().getStringExtra(key)
, getIntent().getInt(key)
public static
的静态变量,在startActivity
之前为这些变量赋值。官方不推荐ClipboardManager clipboard =
(ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
, clipboard.setText(string);
。缺点:只能传递字符串。(注:可通过ByteArrayOutputStream
, ObjectOutputStream
, Base64
将可序列化的对象转换为字符串,接收方再转换为原对象来实现传递。getApplicationContext()
获得全局对象,并可对其属性赋值。几个重要的xml属性:
使用<include>
标签:
<include android:id="@+id/cell1" layout=@layout/workspace_screen" />
<include android:id="@+id/cell2" layout=@layout/workspace_screen" />
<include android:id="@+id/cell3" layout=@layout/workspace_screen" />
注:如果要覆盖布局的尺寸,必须同时覆盖android:layout_width
(原书为android:layout_weight)和android:layout_height
。只覆盖一个无效。
Written with StackEdit.
4种方法:
intent.putExtra(key, value)
。在接收方:getIntent().getStringExtra(key)
, getIntent().getInt(key)
public static
的静态变量,在startActivity
之前为这些变量赋值。官方不推荐ClipboardManager clipboard =
(ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
, clipboard.setText(string);
。缺点:只能传递字符串。(注:可通过ByteArrayOutputStream
, ObjectOutputStream
, Base64
将可序列化的对象转换为字符串,接收方再转换为原对象来实现传递。getApplicationContext()
获得全局对象,并可对其属性赋值。几个重要的xml属性:
使用<include>
标签:
<include android:id="@+id/cell1" layout=@layout/workspace_screen" />
<include android:id="@+id/cell2" layout=@layout/workspace_screen" />
<include android:id="@+id/cell3" layout=@layout/workspace_screen" />
注:如果要覆盖布局的尺寸,必须同时覆盖android:layout_width
(原书为android:layout_weight)和android:layout_height
。只覆盖一个无效。
Written with StackEdit.
华为的电信定制手机C8812连接Ubuntu后,打开调试模式,使用命令
adb devices
返回如下结果
➜ 51-android git:(develop) adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
emulator-5554 device
???????????? device
识别出了手机,也能在命令行的ADB中正常使用。但是却不能在Eclipse中使用,就因为那一行问号。解决办法不是Google官方的添加 /etc/udev/rules.d/51-android.rules 文件(添加这个文件之前adb devices显示的结果就是这样)。而是华为自己的问题,解决办法如下,来自这里
完成步骤5后就可以了,不要重启,我第一次找到这个方法时,按帖子说的重启了,结果又变回去了。
事实又一次证明,国产手机对于好玩机的人来说就是个坑,尤其是定制机。
Written with StackEdit.
无意中看到了CSDN办的黑马程序员训练营,培训Android开发,说是平均工资7K。学习时间4个月,学费13500,可就业后分12个月付款。下载了一集它的入学前必看的基础视频看了一下。想起了去年在东软的日子,都是同一性质批量生产程序员的培训机构,没多少区别。要说有区别,这个视频上讲课的教师思路清晰,写代码很快,是个老手。20多分钟就从零开始做了一个可以播放音频文件的Android出来,还注意到了基本的易错的地方。讲的节奏很快,照这个速度,如果是我学4个月应该能做一个合格的入门Android程序员了。
前几天也看了一个微软程序员的博客(刘未鹏,博客),他很重视学习方法,读了许多认知心理学方面的书。他也讲到现在的大学教育(软件开发这一块)与软件公司的用人需求严重脱节的现象,还专门写了一篇博文(怎样花两年时间去面试一个人)。分析这个问题并给出了可行的建议。他写到现在学软件的大学生的困惑:
绝大多数应届生直到毕业也不清楚他们想要去的公司到底需要什么样的能力,或者说,他们到底需要具备什么样的能力才能在应聘季节拥有自己的选择权。中国虽然本科教育环境差,但是同样有很多的人在本科希望整点东西出来,他们有一腔的激情和抱负,有强大的动力,但就是不知道自己需要掌握哪些技能才能满足雇主的要求,求告无门,整年整年苦闷的像没头苍蝇一样乱撞。
我觉得我就是这个处境,大学三年了,学了些C,C++的语言基础,也认真读完了《深入浅出MFC》对MFC的原理也大略有个了解。可也于了解,学完了基础就不知道接下来干什么了。我知道其实这主要是因此我懒,有那么多开源项目可以去学习,或者自己写小软件自娱自乐,可是我都没有做。我只乐于学习一些小Trick,比如结构体的内存对齐,C函数参数的入栈顺序有哪几种,C++的虚函数,纯虚函数,又或者一些漂亮的命令行命令,却又不去系统的学习bash。玩Linux又不去看鸟歌的书,也不编译内核,也不写大的程序。学了Python,仅止于能爬几个页面,处理个字符串,不去学Web框架。
我去学个黑马程序员培训班学的话,如果出来真能找到7k的工作,那比考研好多了。因为我就需要有实际的项目需求摆在那里,督促着我去学习,只有这样,我才知道该往哪里努力。而程序员学习本应该是这样的,以实际需求为导向,缺哪补哪。而且以我在大学学习的基础知识(操作系统,体系结构,算法),加上培训后掌握的开发经验,进一般的软件公司应该没有问题。进入公司,才算上了道。老在学校里,我又不会和人交往,永远不知道自己该干什么,知道了也没有压力和动力学习。对这个大学早已厌倦了。也不想继续读研究生了,虽然考上的可能性也很小。那就明年毕业后去黑马吧。
告诉我该做什么,怎样做,我就能做好。
Written with StackEdit.
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev\
libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev libperl-dev python-dev
其中libperl-dev和python-dev分别用于perl和python脚本支持。如果需要lua和ruby的支持,需要分别安装 liblua5.1-0-dev 和 ruby-dev。
git clone https://github.com/b4winckler/vim.git
cd ~/vim其中
./configure --with-features=huge --with-python-config-dir=/usr/lib/python2.7/config/ --enable-multibyte --enable-cscope --enable-fontset --enable-gui=auto --disable-hangulinput --enable-luainterp=yes --enable-perlinterp=yes --enable-pythoninterp=yes --enable-xim --prefix=/usr
![]() |
ZSH自动补全功能 |
make
./src/vim --version确认没有问题后,根据下面参考文档的建议,先把系统原来的vim卸载掉(我安装时没有卸载,安装后vi命令指向的还是原来的vim,vim也是原来的vim。因为我原来的vm安装在/usr/local/bin,现在的vim安装在/usr/bin,vi是vim的链接。新vim安装后好像不会更新vi的链接)
./src/vim
sudo apt-get remove vim vim-addon-manager vim-common vim-gui-common vim-tiny vim-scripts vim-runtime然后再安装
sudo make install
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 1
sudo update-alternatives --set editor /usr/bin/vim
sudo update-alternatives --install /usr/bin/vi vi /usr/bin/vim 1
sudo update-alternatives --set vi /usr/bin/vim
texdoc texlive-zh-cn
命令可打开此文件tlmgr
的程序,它可以用来管理安装后的TeX Live系统。tlmgr -gui
tlmgr update -all
tlmgr update -all -dry-run
tlmgr update -list
tlmgr -repository /local/mirror/tlnet install collection-xetex
tlmgr show collection-latexextra
bin TEX 系统程序,按平台组织。
readme.html 网页,提供了多种语言的简介和有用的链接。
readme-*.dir Tex Live 多种语言的简介和有用的链接,同时有 HTML 和纯文本版本。
source 所有程序的源代码,包括主要的基于 Web2C 的 TEX 发行版。
texmf-dist 最主要的文件树,见下文的 TEXMFDIST。
tlpkg 用来维护安装程序所用到的脚本,程序和数据,以及对 Windows 的特殊支持。
texdoc texlive-zh-cn # 打开TeX Live的中文文档
texdoc ctex
顶层目录下的 doc.html
文件中提供的完整的链接会有帮助。程序的文档 (手册,man
page, Info 文件等) 在 texmf-dist/doc
目录下,因为这些程序本身是属于 texmf 目录的。TEX 宏包与格式文件的文档则放在 texmf-dist/doc
目录。但不管放在哪个地方,你都可以使用 texdoc
程序来寻找这些文档。texmf-dist/doc/texlive
目录下。tlmgr conf
列出系统中用于指定 texmf 目录的所有预定义变量=========================== version information ==========================
tlmgr revision 31082 (2013-07-03 06:25:56 +0200)
tlmgr using installation: /opt/texlive/2013
TeX Live (http://tug.org/texlive) version 2013
==================== executables found by searching PATH =================
PATH: /usr/local/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/texlive/2013/bin/x86_64-linux
kpsewhich: /usr/local/bin/kpsewhich
updmap: /usr/local/bin/updmap
fmtutil: /usr/local/bin/fmtutil
tlmgr: /usr/local/bin/tlmgr
tex: /usr/local/bin/tex
pdftex: /usr/local/bin/pdftex
mktexpk: /usr/local/bin/mktexpk
dvips: /usr/local/bin/dvips
dvipdfmx: /usr/local/bin/dvipdfmx
=========================== active config files ==========================
texmf.cnf: /opt/texlive/2013/texmf.cnf
updmap.cfg: /opt/texlive/2013/texmf-dist/web2c/updmap.cfg
fmtutil.cnf: /opt/texlive/2013/texmf-var/web2c/fmtutil.cnf
config.ps: /opt/texlive/2013/texmf-dist/dvips/config/config.ps
mktex.cnf: /opt/texlive/2013/texmf-dist/web2c/mktex.cnf
pdftexconfig.tex: /opt/texlive/2013/texmf-dist/tex/generic/config/pdftexconfig.tex
============================= font map files =============================
psfonts.map: /opt/texlive/2013/texmf-var/fonts/map/dvips/updmap/psfonts.map
pdftex.map: /opt/texlive/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map
ps2pk.map: /opt/texlive/2013/texmf-var/fonts/map/dvips/updmap/ps2pk.map
dvipdfm.map: =========================== kpathsea variables ===========================
TEXMFMAIN=/opt/texlive/2013/texmf-dist
TEXMFDIST=/opt/texlive/2013/texmf-dist
TEXMFLOCAL=/opt/texlive/2013/../texmf-local
TEXMFSYSVAR=/opt/texlive/2013/texmf-var
TEXMFSYSCONFIG=/opt/texlive/2013/texmf-config
TEXMFVAR=/home/starfish/.texlive2013/texmf-var
TEXMFCONFIG=/home/starfish/.texlive2013/texmf-config
TEXMFHOME=/home/starfish/.texlive/texmf
VARTEXFONTS=/home/starfish/.texlive2013/texmf-var/fonts
TEXMF={/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}
SYSTEXMF=/opt/texlive/2013/texmf-var:/opt/texlive/2013/../texmf-local:/opt/texlive/2013/texmf-dist
TEXMFDBS={!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}
WEB2C={/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}/web2c
TEXPSHEADERS=.:{/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}/{dvips,fonts/{enc,type1,type42,type3}}//
TEXCONFIG={/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}/dvips//
ENCFONTS=.:{/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}/fonts/enc//
TEXFONTMAPS=.:{/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}/fonts/map/{kpsewhich,pdftex,dvips,}//
==== kpathsea variables from environment only (ok if no output here) ====
TEXMFDIST 这个目录树包含几乎所有原有发行版本的文件——配置文件、脚本、宏包、字体等等。唯一的例外是每个平台的可执行文件,存储在与它同级的 bin/ 目录下。
TEXMFLOCAL 系统管理员用来安装供整个系统使用的额外的或更新过的宏包、字体的目录。
TEXMFHOME 给用户存放它们自己独立安装的的宏包、字体等等。这个变量根据不同的用户选择不同的主目录。
TEXMFCONFIG 给 texconfig、updmap、和 fmtutil 这些程序存储个人修改过的配置文件。
TEXMFSYSCONFIG 给 texconfig-sys、updmap-sys 和 fmtutil-sys 这些程序存储修改过的全局文件。
TEXMFVAR 这个目录是给 texconfig、updmap 和 fmtutil 存储 (缓存) 格式文件、生成 map 文件这类运行时个人数据的。
TEXMFSYSVAR 给 texconfig-sys、updmap-sys 和 fmtutil-sys 还有 tlmgr 这几个命令存储、缓存运行时使用的格式文件和生成的 map 文件,对整个系统都有效。
TEXMFCACHE ConTEXt MkIV 和 LuaL A TEX用来保存(缓存的)运行时数据的目录树;缺省为TEXMFSYSVAR,如果该目录不可写,则使用 TEXMFVAR。
2012 上一个版本。
2013 当前版本。
bin
i386-linux GNU/Linux 二进制文件
...
universal-darwin Mac OS X 二进制文件
win32 Windows 二进制文件
texmf-dist TEXMFDIST 和 TEXMFMAIN
texmf-var TEXMFSYSVAR, TEXMFCACHE
texmf-config TEXMFSYSCONFIG
texmf-local TEXMFLOCAL 用来存放在不同版本间共享的数据。
.texlive2012 给上个版本的,个人生成和配置的数据。
.texlive2013 给这个版本的,个人生成和配置的数据。
texmf-var TEXMFVAR, TEXMFCACHE
texmf-config TEXMFCONFIG
texmf TEXMFHOME 个人的宏包文件,等等。等等。
知道了TeX Live组织目录的规则,我们手动安插宏包、字体时就要有章可循了。Written with StackEdit.
我就试试-=-
一元二次方程 \(ax^2 + bx +c = 0\)的解为: \[ x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]
公式是使用MathJax渲染的\(\LaTeX{}\)代码。安装使用见这里: http://docs.mathjax.org/en/v1.1-latest/start.html
前天在Ubuntu 12.04下,使用网络安装的方法安装了TeX Live 2013。XeTeX最近成为中文LaTeX排版的新趋势,我也想尝试一下,因此卸载了系统源里的2012版,并安装2013版。因为XeTeX还没有正式发布,目前正在活跃的开发中,这一年时间肯定修正了不少bug,值得更新。
下载地址:http://www.tug.org/texlive/acquire-netinstall.html
(官方中文指南下载:TeX Live指南)
下载安装程序后,按照这个 Quick Install 就可以方便的安装了。这里把主要过程简记如下:
tar xzf install-tl-unx.tar.gz
./install-tl --location http://mirrors.ustc.edu.cn/CTAN/
./install-tl -gui --location http://mirrors.ustc.edu.cn/CTAN/
。需要注意,使用图形界面需要安装perl-tk包(sudo apt-get install perl-tk
),否则无法启动图形界面。/opt/texlive/2013
(我对/opt/
目录拥有写入权限,如果你对要安装的目录没有定稿权限,需要以root身份sudo ./install-tl 参数
重新运行安装程序),TEXMFHOME
变量选的是~/.texlive/texmf
。install scheme
,如果是新手,选full scheme
可以省去很多麻烦。如果是LaTeX大神级的,那估计也不用看我的文章了=_=。我选的是custom selections of collections
。然后进入customizing installation collections
选择要安装的collection
。这提供了比scheme
更细的方法控制安装哪些包。选的越多需要的硬盘空间越大,全选的话需要3.9G的样子,我的选择需要1.9G,其中的字体和文档都是大部头,可以适当取消几个。使用bash或者zsh的,在~/.profile
里添加以下内容
PATH=$PATH:/opt/texlive/2013/bin/x86_64-linux export PATH
或者在安装过程中选择了在系统目录创建链接。如果没选,也可以运行tlmgr -gui
,从菜单里选择创建链接。
Designed for
(英文系统)排序,向下拉找到值为Han (Simplified)
的字体,复制下来,送到Linux的~/.fonts
目录。sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei xfonts-wqy fonts-arphic-ukai fonts-arphic-uming
)。如果用那些版权字体不舒服,只用这两种也足够了。把获得的各种字体放到~/.fonts目录下。然后运行
fc-cache -fv`更新系统字体缓存。
使用fc-list :lang=zh family style file spacing
命令查看安装的中文字体。其中字体的名称可能有英文、简中、繁中等多个,使用其中哪一个都行(应该是的)。可以使用下面的命令把这个列表保存到文件chinesefontname中,并对字体名进行排序
fc-list :lang=zh family style file spacing | awk -F: 'BEGIN {OFS=" : "} {print $2 , $1 , $3 }' | sort > chinesefontname
把上面命令中的:lang=zh
去掉可以查看系统中的所有字体。
Linux系统下,需要配置一下XeTeX才能找到随TeX Live安装的字体。
cp /opt/texlive/2013/texmf-var/fonts/conf/texlive-fontconfig.conf ~/.fonts.conf # 个人使用
# 或者
sudo cp /opt/texlive/2013/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf # 系统所有用户可用
fc-cache -fv # 安装在~/.fonts.conf
# 或者
fc-cache -fsv # 安装在/etc/fonts/
注意一点,如果你的~/.fonts.conf
中原来有内容,比如我就使用文泉驿Fontconfig Designer(视觉习惯) 生成过这个文件,这是个很好用的工具,不想丢掉它生成的内容,打开这两个文件比较一下,发现两个的内容可以合并。把texlive-fontconfig.conf
处在fontconfig
标签之间的三行
<dir>/opt/texlive/2013/texmf-dist/fonts/opentype</dir>
<dir>/opt/texlive/2013/texmf-dist/fonts/truetype</dir>
<dir>/opt/texlive/2013/texmf-dist/fonts/type1</dir>
复制到~/.fonts.conf
的<fontconfig>
标签的下一行即可。合并后的~/.fonts.conf
的部分内容如下(前一个注释是我自己加的):
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- manually copied from /opt/texlive/2013/texmf-var/fonts/conf/texlive-fontconfig.conf used by XeTeX -->
<dir>/opt/texlive/2013/texmf-dist/fonts/opentype</dir>
<dir>/opt/texlive/2013/texmf-dist/fonts/truetype</dir>
<dir>/opt/texlive/2013/texmf-dist/fonts/type1</dir>
<!-- created by WenQuanYi FcDesigner v0.5 -->
<match>
<test name="family"><string>sans-serif</string></test>
<edit name="family" mode="prepend" binding="strong">
......
示例如下
% !TEX program = xelatex
\documentclass[12pt,a4paper]{article}
\usepackage{ctex}
\usepackage{fontspec}
% 微软雅黑 \yahei
\setCJKfamilyfont{MSYAHEI}{微软雅黑}
\newcommand{\yahei}{\CJKfamily{MSYAHEI}}
% 楷体 \kai
\setCJKfamilyfont{KAITI}{楷体}
\newcommand{\kai}{\CJKfamily{KAITI}}
\setmainfont[BoldFont=黑体,ItalicFont=楷体]{宋体}
\setsansfont[BoldFont=黑体]{楷体}
\setmonofont{文泉驿等宽微米黑}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
\begin{document}
\zihao{-4}
中文字体!(默认宋体) \\
{\yahei 微软雅黑字体} \\
\kai{楷体。两小儿问孔子} \\
\youyuan{xeCJK 系统定义好的幼圆字体}
\textsf{无衬线字体(楷体)} \\
\textbf{\textsf{无衬线字体粗体(黑体)}} \\
\texttt{打字机字体文(泉驿等宽微米黑)} \\
\end{document}
一定要使用xelatex
编译,使用xetex不行。
输出果与预期稍有不同,\textsf
好像把字体变成了仿宋(从输出的pdf文件看),原因不明。
完整的错误如下
! fontspec error: "font-not-found"
!
! The font "[SIMKAI.TTF]" cannot be found.
原因是xeCJK
配置文件里写的字体文件名与你实际用的文件名不一样,所以就看不到字体了。修正方法是修改texmf-dist/tex/latex/ctex/fontset/ctex-xecjk-winfonts.def
文件,把里面的字体改成你在fc-list
看到的正确字体,我修改的结果如下(把所有字体都改成了中文):
% ctex-xecjk-winfonts.def: Windows 的 xeCJK 字体设置,默认为六种中易字体
% vim:ft=tex
\setCJKmainfont[BoldFont={黑体},ItalicFont={楷体}]
{宋体}
\setCJKsansfont{黑体}
\setCJKmonofont{仿宋}
> Blockquote
\setCJKfamilyfont{zhsong}{宋体}
\setCJKfamilyfont{zhhei}{黑体}
\setCJKfamilyfont{zhkai}{楷体}
\setCJKfamilyfont{zhfs}{仿宋}
\setCJKfamilyfont{zhli}{隶书}
\setCJKfamilyfont{zhyou}{幼圆}
\newcommand*{\songti}{\CJKfamily{zhsong}} % 宋体
\newcommand*{\heiti}{\CJKfamily{zhhei}} % 黑体
\newcommand*{\kaishu}{\CJKfamily{zhkai}} % 楷书
\newcommand*{\fangsong}{\CJKfamily{zhfs}} % 仿宋
\newcommand*{\lishu}{\CJKfamily{zhli}} % 隶书
\newcommand*{\youyuan}{\CJKfamily{zhyou}} % 幼圆
\endinput
从这里可以看出,xeCJK
为我们提供了6个预定义的字体命令:\songti, \heiti, \kaishu, \fangsong, \lishu, \youyuan
,可以直接使用。1
Template
-> Edit HTML
,在编辑器的前几行找到<head>
标签(可以用Ctrl+F查找),在<head>
标签下插入如下内容:<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
点击Save Template
,保存即可。<pre class="prettyprint">...</pre> <!--或者-->
<code class="prettyprint">...</code>
<pre class="prettyprint linenums:4"> ... </pre> <!--行号从4开始-->
<pre class=prettyprint>
int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
Continuation of comment */
int y = bar();
</pre>
int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
Continuation of comment */
int y = bar();
Template
-> Customize
-> Advanced
-> Add CSS
里添加以下内容
.post-body p {
text-indent: 2.0em;
line-height:150%;
font-size: 17px;
}
.post-body li{
line-height: 1.5em;
margin-bottom: 1em;
margin-top: 1em;
}
h2{
font-size: 1.3em;
margin-top: 1.2em;
margin-bottom: 1.2em;
}
h3{
font-size: 1.2em;
margin-top: 1.2em;
margin-bottom: 1.2em;
}
h4{
font-size: 1.1em;
margin-top: 1em;
margin-bottom: 1.1em;
}
这篇博文(codeitpretty.com)详细讲解了用CSS设置与字体相关的属性,有兴趣可以读一读,学习一下。Written with StackEdit.
Hello, I am your first Markdown document within StackEdit1. Don't delete me, I can be helpful. I can be recovered anyway in the Utils
tab of the Settings
dialog.
StackEdit stores your documents in the browser local storage, which means all your documents are automatically saved locally and are accessible offline.
You can create a new document by clicking the button in the navigation bar. This will switch from the current document to the new one.
You can list all your local documents and switch from one to another by clicking the button in the navigation bar.
You can rename the current document by clicking the document title in the navigation bar.
You can delete the current document by clicking the button in the navigation bar.
StackEdit can be combined with Google Drive and Dropbox to have your documents centralized in the Cloud. The synchronization mechanism will take care of uploading your modifications or downloading the latest version of your documents.
You can import a document from the Cloud by going to the Google Drive
or the Dropbox
sub-menu and by clicking Import from...
. Once imported, your document will be automatically synchronized with the Google Drive / Dropbox file.
You can export any document by going to the Google Drive
or the Dropbox
sub-menu and by clicking Export to...
. Even if your document is already synchronized with Google Drive or Dropbox, you can export it to a another location. StackEdit can synchronize one document with multiple locations.
Once your document is linked to a Google Drive or a Dropbox file, StackEdit will periodically (every 3 minutes) synchronize it by downloading/uploading any modification. Any conflict will be detected, and a local copy of your document will be created as a backup if necessary.
If you just have modified your document and you want to force the synchronization, click the button in the navigation bar.
NOTE: The button is disabled when:
- you are offline,
- or the document is not synchronized with any location,
- or the document has not been modified since the last synchronization.
Since one document can be synchronized with multiple locations, you can list and manage synchronized locations by clicking Manage synchronization
in the menu. This will open a dialog box allowing you to add or remove synchronization links that are associated to your document.
NOTE: If you delete the file from Google Drive or from Dropbox, the document will no longer be synchronized with that location.
Once you are happy with your document, you can publish it on different websites directly from StackEdit. As for now, StackEdit can publish on Blogger, Dropbox, Gist, GitHub, Google Drive, Tumblr, WordPress and on any SSH server.
You can publish your document by going to the Publish on
sub-menu and by choosing a website. In the dialog box, you can choose the publication format:
NOTE: The default template is a simple webpage that wraps your document in HTML format. You can customize it in the
Publish
tab of theSettings
dialog.
After publishing, StackEdit will keep your document linked to that publish location so that you can update it easily. Once you have modified your document and you want to update your publication, click on the button in the navigation bar.
NOTE: The button is disabled when:
- you are offline,
- or the document has not been published anywhere.
Since one document can be published on multiple locations, you can list and manage publish locations by clicking Manage publication
in the menu. This will open a dialog box allowing you to remove publication links that are associated to your document.
NOTE: In some cases, if you remove the file from the website or the post from the blog, the document will no longer be published on that location.
StackEdit supports Markdown Extra, which extends Markdown syntax with some nice features.
Markdown Extra has a special syntax for tables:
Item | Value |
---|---|
Computer | $1600 |
Phone | $12 |
Pipe | $1 |
You can specify column alignment with one or two colons:
Item | Value | Qty |
---|---|---|
Computer | $1600 | 5 |
Phone | $12 | 12 |
Pipe | $1 | 234 |
Markdown Extra has a special syntax for definition lists too:
Definition C
Definition D
part of definition D
GitHub's fenced code blocks are also supported with Prettify syntax highlighting:
// Foo
var bar = 0;
NOTE: To use Highlight.js instead of Prettify, just configure the
Markdown Extra
extension in theSettings
dialog.
With Markdown Extra, you can specify class
and id
attributes on headers and fenced code blocks just like this:
var foo = bar;
Then you can create cross-references like this: beginning of the document.
You can create footnotes like this2.
You can insert a table of contents using the marker [TOC]
:
You can render LaTeX mathematical expressions using MathJax, as on math.stackexchange.com:
The Gamma function satisfying
NOTE: You can find more information: