我正在使用 lmodern 套件編寫文檔,我需要重新定義所有部分以便以粗體和小型大寫字母顯示。我無法將 lmodern 字體更改為另一種字體,包括粗體小型大寫字母和類似的技巧
\usepackage{lmodern}
\usepackage{fontspec}
\usepackage[T1]{fontenc}
{\fontfamily{cmr}\textsc{\textbf{Hello World}}}
當我定義時,它似乎在 Lualatex 中不起作用:
\titleformat{\section}[hang]{\centering\fontfamily{cmr}\large\textsc\textbf}{\Roman{section}.}{2ex}{}[]
有沒有辦法使所有部分變為粗體和小型大寫字母,同時保留文件其餘部分的 lmodern 包?
答案1
該lmodern
軟體包與fontspec
.而且lmodern
與 LuaLaTeX 並不真正相容。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
Straße
Wrocław
\end{document}
用LuaLaTeX編譯得到
但是,如果刪除lmodern
和fontenc
,則不會獲得粗體小型大寫字母,因為這種組合在拉丁現代字體中不可用。
\documentclass{article}
\begin{document}
Straße Wrocław
\textbf{\textsc{Abc}}
\end{document}
現在第一個單字已如預期排版,但沒有粗體小型大寫字母。
您可以使用新電腦現代來代替,它本質上與拉丁現代沒有區別。
\documentclass{article}
\usepackage{fontsetup}
\usepackage{titlesec}
\titleformat{\section}[hang]
{\filcenter\large\scshape\bfseries}
{\Roman{section}.}
{1em}
{}
\begin{document}
\section{Straße Wrocław}
\textbf{\textsc{Abc}}
\end{document}
答案2
您不需要該lmodern
包,因為 Latin Modern 是預設的 lualatex 字體。它沒有粗體小型大寫字母,但您可以為 Computer Modern Unicode 定義字體系列,並在需要小型大寫字母的地方使用它。
您也不應該\usepackage[T1]{fontenc}
與 lualatex 一起使用。
\documentclass{article}
\usepackage{fontspec}
\newfontfamily\cmu{CMU Serif}
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\cmu\Large\bfseries\scshape}}
%%%%%% %%%%%%%%%%x
\makeatother
\begin{document}
{\cmu \textsc{Abc Def} \textsc{\bfseries Abc Def}}
\section{Caps and Small Caps}
xxx
\end{document}