我有一个看似非常简单的问题,但我仍然无法解决它,而且我无法在 Friggeri 的 CV 模板之外重现该问题(对此我很抱歉)。
整个过程尝试获得一种默认的文本颜色,同时仍然允许我更改特定单词/短语的颜色。
我在用Friggeri 的简历模板使用相同的 friggeri-cv.cls(我只将所有 Helvetica 字体更改为 Arial,并将 backend=biber 添加到 \RequirePackage{biblatex} 行)。
这是一个 MWE,您可以看到文本没有改变颜色,但标志会改变。Font Awesome 不被认为是文本吗?
%!TEX TS-program = xelatex
\documentclass[]{friggeri-cv}
\listfiles
\addbibresource{bibliography.bib}
\usepackage{fontawesome}
\newfontfamily{\FA}{FontAwesome}
\begin{document}
\header{name}{surname}
{occupation}
% In the aside, each new line forces a line break
\begin{aside}
\section{sec}
aaa
bbb
\end{aside}
\section{sec}
\begin{entrylist}
\entry
{2014}
{some text here}
{more here}
{and more text
and \textcolor{red}{text in color}
and an icon \textcolor{red}{\faFlag}
and even a \href{http://tex.stackexchange.com/}{link}
}
\end{entrylist}
\end{document}
现在,我知道 .cls 文件中有这一行
\colorlet{textcolor}{gray}
控制默认文本颜色,但我仍然希望默认文本颜色是那样,为什么 \textcolor{red} 不覆盖它?
当我评论该行时,我只会看到彩色文本......
这使我想到自定义链接的问题...我在 .cls 文件中使用以下行(但如果我在 .tex 文件中使用它则不起作用)来删除链接周围的框:
\usepackage[hidelinks]{hyperref}
但是我可以让所有链接都变成蓝色并带有下划线吗?上述命令中的 urlcolor=blue 选项似乎没有任何作用...
编辑:
使用上面的 MWE 我得到以下信息:
如果可能的话,一个很大的优点就是消除水平盒子未满的警告!
非常感谢
编辑2:
在日志文件的末尾,\listfiles 列出了以下内容:
*File List*
friggeri-cv.cls 2012/04/30 CV class
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
luatex-loader.sty 2010/03/09 v0.4 Lua module loader (HO)
fontspec.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
expl3.sty 2014/01/07 v4646 L3 Experimental code bundle wrapper
l3names.sty 2014/01/04 v4640 L3 Namespace for primitives
l3bootstrap.sty 2014/01/04 v4640 L3 Experimental bootstrap code
luatex.sty 2010/03/09 v0.4 LuaTeX basic definition package (HO)
etex.sty 1998/03/26 v2.0 eTeX basic definition package (PEB)
l3basics.sty 2014/01/04 v4642 L3 Basic definitions
l3expan.sty 2014/01/04 v4642 L3 Argument expansion
l3tl.sty 2013/12/27 v4625 L3 Token lists
l3seq.sty 2013/12/14 v4623 L3 Sequences and stacks
l3int.sty 2013/08/02 v4583 L3 Integers
l3quark.sty 2013/12/14 v4623 L3 Quarks
l3prg.sty 2014/01/04 v4642 L3 Control structures
l3clist.sty 2013/07/28 v4581 L3 Comma separated lists
l3token.sty 2013/08/25 v4587 L3 Experimental token manipulation
l3prop.sty 2013/12/14 v4623 L3 Property lists
l3msg.sty 2013/07/28 v4581 L3 Messages
l3file.sty 2013/10/13 v4596 L3 File and I/O operations
l3skip.sty 2013/07/28 v4581 L3 Dimensions and skips
l3keys.sty 2013/12/08 v4614 L3 Experimental key-value interfaces
l3fp.sty 2014/01/04 v4642 L3 Floating points
l3box.sty 2013/07/28 v4581 L3 Experimental boxes
l3coffins.sty 2013/12/14 v4624 L3 Coffin code layer
l3color.sty 2012/08/29 v4156 L3 Experimental color support
l3luatex.sty 2013/07/28 v4581 L3 Experimental LuaTeX-specific functions
l3candidates.sty 2014/01/06 v4643 L3 Experimental additions to l3kernel
xparse.sty 2013/12/31 v4634 L3 Experimental document command parser
luaotfload.sty 2014/02/05 v2.4-3 OpenType layout system
luatexbase.sty 2013/05/11 v0.6 Resource management for the LuaTeX macro progr
ammer
luatexbase-compat.sty 2011/05/24 v0.4 Compatibility tools for LuaTeX
luatexbase-modutils.sty 2013/05/11 v0.6 Module utilities for LuaTeX
luatexbase-loader.sty 2013/05/11 v0.6 Lua module loader for LuaTeX
luatexbase-regs.sty 2011/05/24 v0.4 Registers allocation for LuaTeX
luatexbase-attr.sty 2013/05/11 v0.6 Attributes allocation for LuaTeX
luatexbase-cctb.sty 2013/05/11 v0.6 Catcodetable allocation for LuaTeX
luatexbase-mcb.sty 2013/05/11 v0.6 Callback management for LuaTeX
fontspec-patches.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
fixltx2e.sty 2006/09/13 v1.1m fixes to LaTeX
fontspec-luatex.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
fontenc.sty
eu2enc.def 2010/05/27 v0.1h Experimental Unicode font encodings
eu2lmr.fd 2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty 2011/09/09 v0.981 provides access to latin accents and many othe
r characters in Unicode lower plane
eu2lmss.fd 2009/10/30 v1.6 Font defs for Latin Modern
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
fontspec.cfg
unicode-math.sty 2013/05/04 v0.7e Unicode maths in XeLaTeX and LuaLaTeX
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
l3keys2e.sty 2013/12/31 v4634 LaTeX2e option processing using LaTeX3 keys
catchfile.sty 2011/03/01 v1.6 Catch the contents of a file (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
fix-cm.sty 2006/09/13 v1.1m fixes to LaTeX
ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
filehook.sty 2011/10/12 v0.5d Hooks for input files
unicode-math-luatex.sty
lualatex-math.sty 2013/08/03 v1.3 Patches for mathematics typesetting with Lu
aLaTeX
etoolbox.sty 2011/01/03 v2.1 e-TeX tools for LaTeX
unicode-math-table.tex
tikz.sty 2010/10/13 v2.10 (rcs-revision 1.76)
pgf.sty 2008/01/15 v2.10 (rcs-revision 1.12)
pgfrcs.sty 2010/10/25 v2.10 (rcs-revision 1.24)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v2.10 (rcs-revision 1.7)
pgfsys.sty 2010/06/30 v2.10 (rcs-revision 1.37)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2008/07/18 (rcs-revision 1.7)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v2.10 (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v2.10 (rcs-revision 1.1)
pgffor.sty 2010/03/23 v2.10 (rcs-revision 1.18)
pgfkeys.sty
pgfkeys.code.tex
pgffor.code.tex
tikz.code.tex
parskip.sty 2001/04/09 non-zero parskip adjustments
textpos.sty 2014/01/03 v1.7j
biblatex.sty 2013/11/25 v2.8a programmable bibliographies (PK/JW/AB)
biblatex2.sty 2013/11/25 v2.8a programmable bibliographies (biber) (PK/JW/AB)
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
logreq.sty 2010/08/04 v1.0 xml request logger
logreq.def 2010/08/04 v1.0 logreq spec v1.0
ifthen.sty 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
blx-dm.def
verbose.dbx
biblatex-dm.cfg
blx-compat.def 2013/11/25 v2.8a biblatex compatibility (PK/JW/AB)
biblatex.def
standard.bbx 2013/11/25 v2.8a biblatex bibliography style (PK/JW/AB)
authortitle.bbx 2013/11/25 v2.8a biblatex bibliography style (PK/JW/AB)
verbose.bbx 2013/11/25 v2.8a biblatex bibliography style (PK/JW/AB)
verbose.cbx 2013/11/25 v2.8a biblatex citation style (PK/JW/AB)
biblatex.cfg
geometry.sty 2010/09/12 v5.6 Page Geometry
ifvtex.sty 2010/03/01 v1.5 Detect VTeX and its facilities (HO)
hyperref.sty 2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty 2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2012/05/28 v1.13 Bundle oberdiek, subset generic (HO)
hobsub.sty 2012/05/28 v1.13 Construct package bundles (HO)
intcalc.sty 2007/09/27 v1.1 Expandable calculations with integers (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
pdfescape.sty 2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2012/04/08 v1.3 Expandable calculations on big integers (HO)
bitset.sty 2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty 2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty 2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
hopatch.sty 2012/05/28 v1.2 Wrapper for package hooks (HO)
xcolor-patch.sty 2011/01/30 xcolor patch
atveryend.sty 2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty 2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty 2011/10/16 v3.4 Data extraction from label references (HO)
hycolor.sty 2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
auxhook.sty 2011/03/04 v1.3 Hooks for auxiliary files (HO)
pd1enc.def 2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
hpdftex.def 2012/11/06 v6.83m Hyperref driver for pdfTeX
rerunfilecheck.sty 2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
fontawesome.sty 2013/05/10 v3.1.1 font awesome icons
english.lbx 2013/11/25 v2.8a biblatex localization (PK/JW/AB)
t3cmr.fd 2001/12/31 TIPA font definitions
supp-pdf.mkii
epstopdf-base.sty 2010/02/09 v2.5 Base part for package epstopdf
grfext.sty 2010/08/19 v1.1 Manage graphics extensions (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
cv.bbl
nameref.sty 2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty 2010/12/03 v1.4 Cleanup title references (HO)
cv.out
cv.out
***********
新编辑:
我曾尝试在不使用 Friggeri 模板的情况下重现该错误,但没有成功,以下行没有达到预期的效果:\colorlet{textcolor}{blue} 但必须这样做,因为我不想过多触碰 Friggeri 模板……有人有什么想法吗?
这是 MWE
%!TEX TS-program = xelatex
\documentclass{article}
\listfiles
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{fontawesome}
\newfontfamily{\FA}{FontAwesome}
\colorlet{textcolor}{blue}
\begin{document}
and more text
and \textcolor{red}{text in color}
and an icon \textcolor{red}{\faFlag}
and even a \href{http://tex.stackexchange.com/}{link}
\end{document}
答案1
字体颜色
该类将属性friggery-cv.cls
设置Color
为字体:
\colorlet{textcolor}{gray}
\setmainfont[Mapping=tex-text, Color=textcolor]{Helvetica Neue Light}
然后颜色是字体的一部分,不能从外部改变。以下示例显示了这一点。\textcolor{red}
工作方式与红色\fbox
相同,但字体仍为蓝色:
\documentclass{article}
\usepackage{xcolor}
\usepackage{fontspec}
\setmainfont[Color=blue]{FreeSans}
\begin{document}
Hello \textcolor{red}{\fbox{World}}
\end{document}
解决方法
新字体没有
Color
可以定义该特征。然后\textcolor
应用于无色字体。下面的示例改变
Color
当前字体的属性:\documentclass{article} \usepackage{xcolor} \usepackage{fontspec} \setmainfont[Color=blue]{FreeSans} \begin{document} Hello {\addfontfeature{Color=red}World} \end{document}
链接定制
蓝色下划线链接,hyperref
见自述,“链接边框样式”部分。
\documentclass{article}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{
allbordercolors=blue,
pdfborderstyle={/S/U/W 1},
}
\begin{document}
\tableofcontents
\section{Test section}
\label{sec:test}
A reference to \hyperref[sec:test]{this section}.
This example can be found in
\href{http://tex.stackexchange.com/a/183340/16967}{this answer}.
URL of the question:
\url{http://tex.stackexchange.com/q/183170/16967}
\end{document}