如何使用拉丁现代字体或计算机现代字体获得粗体+小写字母

如何使用拉丁现代字体或计算机现代字体获得粗体+小写字母

我正在尝试使用 xeLaTeX...但我没有使用标准字体(拉丁现代字体或计算机现代字体?)获得粗体小写字体。

使用 LaTeX,我使用它来解决问题,因为我知道粗体小型大写字母不会与 lmodern 一起出现。

   \usepackage{lmodern} \usepackage{fix-cm}
   \rmfamily
   \DeclareFontShape{T1}{lmr}{b}{sc}{<->ssub*cmr/bx/sc}{}
   \DeclareFontShape{T1}{lmr}{bx}{sc}{<->ssub*cmr/bx/sc}{}

如何用 xeLaTeX 制作类似的东西?也许使用 cm-unicode(用于缺失的字体)?但我不明白该怎么做...

我已看到更多有关此问题的帖子,但没有给出解决方案。

谢谢。

\documentclass[a4paper,10pt]{article}
\usepackage{fontspec}
\usepackage{xunicode}

\begin{document}

\textsc{\textbf{Essai 1}}

\textbf{\textsc{Essai 2}}

{\fontseries{b}\fontshape{sc}\selectfont Essai 3}

{\fontseries{bx}\fontshape{sc}\selectfont Essai 3}

\end{document}

我已经尝试使用 \setmainfont{CMU Serif} 但是收到错误:

! 无法找到字体“CMU Serif”。

\documentclass[11pt]{article}

    \usepackage[tuenc]{fontspec}%for lualatex case

\setmainfont{CMU Serif}

\begin{document}

  not bold or caps

\textsc{small caps}    

\textbf{\textsc{bold small caps}}

\textbf{bold}

\end{document} 

日志如下:

This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016) (preloaded format=xelatex 2016.8.4)  16 OCT 2016 19:51
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**ECM_solution.tex
(./ECM_solution.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size11.clo
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3.sty
Package: expl3 2016/05/18 v6512 L3 programming layer (loader) 

(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3-code.tex
Package: expl3 2016/05/18 v6512 L3 programming layer (code)
L3 Module: l3bootstrap 2016/02/12 v6412 L3 Bootstrap code
L3 Module: l3names 2016/03/11 v6433 L3 Namespace for primitives
L3 Module: l3basics 2015/11/22 v6315 L3 Basic definitions
L3 Module: l3expan 2015/09/10 v5983 L3 Argument expansion
L3 Module: l3tl 2016/03/26 v6465 L3 Token lists
L3 Module: l3str 2016/03/24 v6441 L3 Strings
L3 Module: l3seq 2015/08/05 v5777 L3 Sequences and stacks
L3 Module: l3int 2016/03/24 v6441 L3 Integers
\c_max_int=\count87
\l_tmpa_int=\count88
\l_tmpb_int=\count89
\g_tmpa_int=\count90
\g_tmpb_int=\count91
L3 Module: l3quark 2015/08/17 v5855 L3 Quarks
L3 Module: l3prg 2015/11/01 v6216 L3 Control structures
\g__prg_map_int=\count92
L3 Module: l3clist 2015/09/02 v5901 L3 Comma separated lists
L3 Module: l3token 2016/04/03 v6470 L3 Experimental token manipulation
L3 Module: l3prop 2016/01/05 v6366 L3 Property lists
L3 Module: l3msg 2016/03/26 v6464 L3 Messages
L3 Module: l3file 2016/03/25 v6458 L3 File and I/O operations
\l_iow_line_count_int=\count93
\l__iow_target_count_int=\count94
\l__iow_current_line_int=\count95
\l__iow_current_word_int=\count96
\l__iow_current_indentation_int=\count97
L3 Module: l3skip 2016/01/05 v6366 L3 Dimensions and skips
\c_zero_dim=\dimen103
\c_max_dim=\dimen104
\l_tmpa_dim=\dimen105
\l_tmpb_dim=\dimen106
\g_tmpa_dim=\dimen107
\g_tmpb_dim=\dimen108
\c_zero_skip=\skip43
\c_max_skip=\skip44
\l_tmpa_skip=\skip45
\l_tmpb_skip=\skip46
\g_tmpa_skip=\skip47
\g_tmpb_skip=\skip48
\c_zero_muskip=\muskip10
\c_max_muskip=\muskip11
\l_tmpa_muskip=\muskip12
\l_tmpb_muskip=\muskip13
\g_tmpa_muskip=\muskip14
\g_tmpb_muskip=\muskip15
L3 Module: l3keys 2015/11/17 v6284 L3 Key-value interfaces
\g__keyval_level_int=\count98
\l_keys_choice_int=\count99
L3 Module: l3fp 2016/03/26 v6465 L3 Floating points
\c__fp_leading_shift_int=\count100
\c__fp_middle_shift_int=\count101
\c__fp_trailing_shift_int=\count102
\c__fp_big_leading_shift_int=\count103
\c__fp_big_middle_shift_int=\count104
\c__fp_big_trailing_shift_int=\count105
\c__fp_Bigg_leading_shift_int=\count106
\c__fp_Bigg_middle_shift_int=\count107
\c__fp_Bigg_trailing_shift_int=\count108
L3 Module: l3box 2015/08/09 v5822 L3 Experimental boxes
\c_empty_box=\box26
\l_tmpa_box=\box27
\l_tmpb_box=\box28
\g_tmpa_box=\box29
\g_tmpb_box=\box30
L3 Module: l3coffins 2016/05/17 v6508 L3 Coffin code layer
\l__coffin_internal_box=\box31
\l__coffin_internal_dim=\dimen109
\l__coffin_offset_x_dim=\dimen110
\l__coffin_offset_y_dim=\dimen111
\l__coffin_x_dim=\dimen112
\l__coffin_y_dim=\dimen113
\l__coffin_x_prime_dim=\dimen114
\l__coffin_y_prime_dim=\dimen115
\c_empty_coffin=\box32
\l__coffin_aligned_coffin=\box33
\l__coffin_aligned_internal_coffin=\box34
\l_tmpa_coffin=\box35
\l_tmpb_coffin=\box36
\l__coffin_display_coffin=\box37
\l__coffin_display_coord_coffin=\box38
\l__coffin_display_pole_coffin=\box39
\l__coffin_display_offset_dim=\dimen116
\l__coffin_display_x_dim=\dimen117
\l__coffin_display_y_dim=\dimen118
L3 Module: l3color 2014/08/23 v5354 L3 Experimental color support
L3 Module: l3sys 2015/09/25 v6087 L3 Experimental system/runtime functions
L3 Module: l3candidates 2016/05/13 v6484 L3 Experimental additions to l3kernel
\l__box_top_dim=\dimen119
\l__box_bottom_dim=\dimen120
\l__box_left_dim=\dimen121
\l__box_right_dim=\dimen122
\l__box_top_new_dim=\dimen123
\l__box_bottom_new_dim=\dimen124
\l__box_left_new_dim=\dimen125
\l__box_right_new_dim=\dimen126
\l__box_internal_box=\box40
\l__coffin_bounding_shift_dim=\dimen127
\l__coffin_left_corner_dim=\dimen128
\l__coffin_right_corner_dim=\dimen129
\l__coffin_bottom_corner_dim=\dimen130
\l__coffin_top_corner_dim=\dimen131
\l__coffin_scaled_total_height_dim=\dimen132
\l__coffin_scaled_width_dim=\dimen133
L3 Module: l3luatex 2016/03/26 v6465 L3 Experimental LuaTeX-specific functions
)
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def
File: l3xdvidpfmx.def 2016/03/26 v6465 L3 Experimental driver: xdvipdfmx
\l__driver_tmp_box=\box41
))
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
Package: xparse 2016/05/18 v6512 L3 Experimental document command parser
\l__xparse_current_arg_int=\count109
\l__xparse_m_args_int=\count110
\l__xparse_mandatory_args_int=\count111
\l__xparse_processor_int=\count112
\l__xparse_v_nesting_int=\count113
)
Package: fontspec 2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTeX

(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
Package: fontspec-xetex 2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTe
X
\l_fontspec_script_int=\count114
\l_fontspec_language_int=\count115
\l_fontspec_strnum_int=\count116
\l__fontspec_tmpa_dim=\dimen134
\l__fontspec_tmpb_dim=\dimen135
\l__fontspec_tmpc_dim=\dimen136
\g__file_internal_ior=\read1

(/usr/local/texlive/2016/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2016/06/19 v1.99m Standard LaTeX package

(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/tuenc.def
File: tuenc.def 2016/01/29 v0.1 Unicode font encoding for LaTeX2e

(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/tufontrange-T1.def
File: ucfontrange-T1.def 
)
(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/tufontrange-TS1.def
File: ucfontrange-TS1.def 
)))
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \__fontspec_post_arg:w with sig. 'mmO{}' on line 353.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \fontspec with sig. 'om' on line 355.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setmainfont with sig. 'om' on line 365.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setsansfont with sig. 'om' on line 375.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setmonofont with sig. 'om' on line 385.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setmathrm with sig. 'om' on line 399.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setboldmathrm with sig. 'om' on line 407.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setmathsf with sig. 'om' on line 415.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setmathtt with sig. 'om' on line 423.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newfontfamily with sig. 'mom' on line 437.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newfontface with sig. 'mom' on line 453.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \defaultfontfeatures with sig. 't+om' on line 467.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \addfontfeatures with sig. 'm' on line 529.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newfontfeature with sig. 'mm' on line 540.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newAATfeature with sig. 'mmmm' on line 548.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newopentypefeature with sig. 'mmm' on line 556.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \aliasfontfeature with sig. 'mm' on line 577.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \aliasfontfeatureoption with sig. 'mmm' on line 586.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newfontscript with sig. 'mm' on line 590.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newfontlanguage with sig. 'mm' on line 594.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \DeclareFontsExtensions with sig. 'm' on line 599.
.................................................
\l__fontspec_tmp_int=\count117

(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec.cfg)
LaTeX Info: Redefining \itshape on input line 2705.
LaTeX Info: Redefining \slshape on input line 2710.
LaTeX Info: Redefining \scshape on input line 2715.
LaTeX Info: Redefining \upshape on input line 2720.
\l__fontspec_em_int=\count118
\l__fontspec_emdef_int=\count119
LaTeX Info: Redefining \em on input line 2736.
LaTeX Info: Redefining \emph on input line 2742.
LaTeX Info: Redefining \- on input line 2746.
.................................................
. LaTeX info: "xparse/redefine-command"
. 
. Redefining command \oldstylenums with sig. 'm' on line 2841.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \liningnums with sig. 'm' on line 2845.
.................................................
))

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "CMU Serif" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.6 \setmainfont{CMU Serif}

|'''''''''''''''''''''''''''''''''''''''''''''''
| A font might not be found for many reasons.
| Check the spelling, where the font is installed etc. etc.
| 
| When in doubt, ask someone for help!
|...............................................

.................................................
. fontspec info: "no-scripts"
. 
. Font CMU Serif does not contain any OpenType `Script' information.
.................................................
\g__fontspec_family_CMUSerif_int=\count120
.................................................
. fontspec info: "no-font-shape"
. 
. Could not resolve font CMU Serif/BI (it probably doesn't exist).
.................................................
.................................................
. fontspec info: "no-font-shape"
. 
. Could not resolve font CMU Serif/B (it probably doesn't exist).
.................................................
.................................................
. fontspec info: "no-font-shape"
. 
. Could not resolve font CMU Serif/I (it probably doesn't exist).
.................................................

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "CMU Serif" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.6 \setmainfont{CMU Serif}

|'''''''''''''''''''''''''''''''''''''''''''''''
| A font might not be found for many reasons.
| Check the spelling, where the font is installed etc. etc.
| 
| When in doubt, ask someone for help!
|...............................................


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "CMU Serif" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.6 \setmainfont{CMU Serif}

|'''''''''''''''''''''''''''''''''''''''''''''''
| A font might not be found for many reasons.
| Check the spelling, where the font is installed etc. etc.
| 
| When in doubt, ask someone for help!
|...............................................

.................................................
. fontspec info: "defining-font"
. 
. Font family 'CMUSerif(0)' created for font 'CMU Serif' with options
. [Ligatures=TeX].
. 
. This font family consists of the following NFSS series/shapes:
. - 'normal' (m/n) with NFSS spec.: <->"CMU Serif:mapping=tex-text;"
. - 'small caps'  (m/sc) with NFSS spec.: <->"CMU Serif:mapping=tex-text;"
.................................................
! Font TU/CMUSerif(0)/m/n/10.95="CMU Serif:mapping=tex-text;" at 10.95pt not lo
adable: Metric (TFM) file or installed font not found.
<to be read again> 
                   relax 
l.6 \setmainfont{CMU Serif}

I wasn't able to read the size data for this font,
so I will ignore the font specification.
[Wizards can fix TFM files using TFtoPL/PLtoTF.]
You might try inserting a different font spec;
e.g., type `I\font<same font id>=<substitute font name>'.

(./ECM_solution.aux)
\openout1 = `ECM_solution.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for TU/lmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
.................................................
. fontspec info: "setup-math"
. 
. Adjusting the maths setup (use [no-math] to avoid this).
.................................................
\symlegacymaths=\mathgroup4
LaTeX Font Info:    Overwriting symbol font `legacymaths' in version `bold'
(Font)                  OT1/cmr/m/n --> OT1/cmr/bx/n on input line 8.
LaTeX Font Info:    Redeclaring math accent \acute on input line 8.
LaTeX Font Info:    Redeclaring math accent \grave on input line 8.
LaTeX Font Info:    Redeclaring math accent \ddot on input line 8.
LaTeX Font Info:    Redeclaring math accent \tilde on input line 8.
LaTeX Font Info:    Redeclaring math accent \bar on input line 8.
LaTeX Font Info:    Redeclaring math accent \breve on input line 8.
LaTeX Font Info:    Redeclaring math accent \check on input line 8.
LaTeX Font Info:    Redeclaring math accent \hat on input line 8.
LaTeX Font Info:    Redeclaring math accent \dot on input line 8.
LaTeX Font Info:    Redeclaring math accent \mathring on input line 8.
LaTeX Font Info:    Redeclaring math symbol \colon on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Gamma on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Delta on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Theta on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Lambda on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Xi on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Pi on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Sigma on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Upsilon on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Phi on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Psi on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Omega on input line 8.
LaTeX Font Info:    Redeclaring math symbol \mathdollar on input line 8.
LaTeX Font Info:    Redeclaring symbol font `operators' on input line 8.
LaTeX Font Info:    Encoding `OT1' has changed to `TU' for symbol font
(Font)              `operators' in the math version `normal' on input line 8.
LaTeX Font Info:    Overwriting symbol font `operators' in version `normal'
(Font)                  OT1/cmr/m/n --> TU/CMUSerif(0)/m/n on input line 8.
LaTeX Font Info:    Encoding `OT1' has changed to `TU' for symbol font
(Font)              `operators' in the math version `bold' on input line 8.
LaTeX Font Info:    Overwriting symbol font `operators' in version `bold'
(Font)                  OT1/cmr/bx/n --> TU/CMUSerif(0)/m/n on input line 8.
LaTeX Font Info:    Overwriting symbol font `operators' in version `normal'
(Font)                  TU/CMUSerif(0)/m/n --> TU/CMUSerif(0)/m/n on input line
 8.
LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `normal'
(Font)                  OT1/cmr/m/it --> TU/CMUSerif(0)/m/it on input line 8.
LaTeX Font Info:    Overwriting math alphabet `\mathbf' in version `normal'
(Font)                  OT1/cmr/bx/n --> TU/CMUSerif(0)/bx/n on input line 8.
LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `normal'
(Font)                  OT1/cmss/m/n --> TU/lmss/m/n on input line 8.
LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `normal'
(Font)                  OT1/cmtt/m/n --> TU/lmtt/m/n on input line 8.
LaTeX Font Info:    Overwriting symbol font `operators' in version `bold'
(Font)                  TU/CMUSerif(0)/m/n --> TU/CMUSerif(0)/bx/n on input lin
e 8.
LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `bold'
(Font)                  OT1/cmr/bx/it --> TU/CMUSerif(0)/bx/it on input line 8.

LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `bold'
(Font)                  OT1/cmss/bx/n --> TU/lmss/bx/n on input line 8.
LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `bold'
(Font)                  OT1/cmtt/m/n --> TU/lmtt/bx/n on input line 8.
Missing character: There is no n in font nullfont!
Missing character: There is no o in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no b in font nullfont!
Missing character: There is no o in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no o in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no p in font nullfont!
Missing character: There is no s in font nullfont!

! Font TU/CMUSerif(0)/m/sc/10.95="CMU Serif:mapping=tex-text;" at 10.95pt not l
oadable: Metric (TFM) file or installed font not found.
<to be read again> 
                   relax 
l.12 \textsc{small caps}

I wasn't able to read the size data for this font,
so I will ignore the font specification.
[Wizards can fix TFM files using TFtoPL/PLtoTF.]
You might try inserting a different font spec;
e.g., type `I\font<same font id>=<substitute font name>'.

Missing character: There is no s in font nullfont!
Missing character: There is no m in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no p in font nullfont!
Missing character: There is no s in font nullfont!

LaTeX Font Warning: Font shape `TU/CMUSerif(0)/bx/n' undefined
(Font)              using `TU/CMUSerif(0)/m/n' instead on input line 14.


LaTeX Font Warning: Font shape `TU/CMUSerif(0)/bx/sc' undefined
(Font)              using `TU/CMUSerif(0)/bx/n' instead on input line 14.

! Font TU/CMUSerif(0)/bx/n/10.95="CMU Serif:mapping=tex-text;" at 10.95pt not l
oadable: Metric (TFM) file or installed font not found.
<to be read again> 
                   relax 
l.14 \textbf{\textsc{bold small caps}}

I wasn't able to read the size data for this font,
so I will ignore the font specification.
[Wizards can fix TFM files using TFtoPL/PLtoTF.]
You might try inserting a different font spec;
e.g., type `I\font<same font id>=<substitute font name>'.

Missing character: There is no b in font nullfont!
Missing character: There is no o in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no s in font nullfont!
Missing character: There is no m in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no p in font nullfont!
Missing character: There is no s in font nullfont!
Missing character: There is no b in font nullfont!
Missing character: There is no o in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no 1 in font nullfont!
[1

] (./ECM_solution.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

 ) 
Here is how much of TeX's memory you used:
 9525 strings out of 493589
 210792 string characters out of 6143513
 217372 words of memory out of 5000000
 12975 multiletter control sequences out of 15000+600000
 3956 words of font info for 17 fonts, out of 8000000 for 9000
 1347 hyphenation exceptions out of 8191
 40i,4n,61p,10352b,235s stack positions out of 5000i,500n,10000p,200000b,80000s

Output written on ECM_solution.pdf (1 page).

答案1

日志文件显示您正在“原始” TeX Live 上使用 XeLaTeX,但 CMU Serif 字体不可用作系统字体。

fc-cache -fsv单独运行是不够的,除非您还将 TeX Live 字体提供给fontconfig库。

这两个命令

> sudo cp $(kpsewhich -var-value TEXMFSYSVAR)/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf
> sudo fc-cache -fsv

应该可以满足您的需要。I>代表 shell 提示符。我们复制的文件09-texlive.conf包含/etc/fonts/conf.d

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/usr/local/texlive/2016/texmf-dist/fonts/opentype</dir>
  <dir>/usr/local/texlive/2016/texmf-dist/fonts/truetype</dir>
  <dir>/usr/local/texlive/2016/texmf-dist/fonts/type1</dir>
</fontconfig>

但这并不重要。重要的是,完成该设置后,TeX Live 主树中的所有字体都将可用fontconfig,因此 XeTeX 也将能够通过字体名称而不是仅通过文件名来找到它们。

如果这不起作用,您可以随时通过文件名调用 CMU Serif:

\documentclass[11pt]{article}

\usepackage[tuenc]{fontspec}

\setmainfont{cmun}[
  Extension=.otf,
  UprightFont=*rm,
  ItalicFont=*ti,
  BoldFont=*bx,
  BoldItalicFont=*bi,
]

\begin{document}

not bold or caps \textsc{small caps}

\textbf{bold} \textbf{\textsc{bold small caps}}

\textit{italic} \textsc{\textit{italic small caps}}

\textbf{\textit{bold italic}} \textbf{\textit{\textsc{bold italic small caps}}}

\end{document}

请注意,CMU Serif Italic 和 CMU Serif BoldItalic 没有小型大写字母字形,因此您会在第三行和第四行看到普通斜体和粗体小型大写字母。

在此处输入图片描述

如果建议的程序fc-cache成功,则代码

\documentclass[11pt]{article}

\usepackage[tuenc]{fontspec}

\setmainfont{CMU Serif}

\begin{document}

not bold or caps \textsc{small caps}

\textbf{bold} \textbf{\textsc{bold small caps}}

\textit{italic} \textsc{\textit{italic small caps}}

\textbf{\textit{bold italic}} \textbf{\textit{\textsc{bold italic small caps}}}

\end{document}

应该与 XeLaTeX 和 LuaLaTeX 一起工作。

答案2

这里给出的解决方案(适用于我的 ubuntu 2016)

将 texlive-fontconfig.conf 复制到 /etc/fonts/conf.d/09-texlive.conf

> sudo cp $(kpsewhich -var-value TEXMFSYSVAR)/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf

修改 /etc/fonts/conf.d/09-texlive.conf :(来源:http://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-340003.4.4

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/usr/local/texlive/2016/texmf-dist/fonts/opentype</dir>
  <dir>/usr/local/texlive/2016/texmf-dist/fonts/truetype</dir>
  <dir>/usr/local/texlive/2016/texmf-dist/fonts/type1</dir>
  <selectfont>
    <rejectfont>
      <glob>/usr/local/texlive/2016/texmf-dist/fonts/type1/public/cm-unicode/*</glob>
    </rejectfont>
  </selectfont>
</fontconfig>

跑步

> sudo fc-cache -fsv

测试:

\documentclass[11pt]{article}
\usepackage[tuenc]{fontspec}
\setmainfont{CMU Serif}
\begin{document}
not bold or caps \textsc{small caps} \par
\textbf{bold} \textbf{\textsc{bold small caps}} \par
\textit{italic} \textsc{\textit{italic small caps}} \par
\textbf{\textit{bold italic}} \textbf{\textit{\textsc{bold italic small caps}}}
\end{document}

相关内容