使用两种不同的无衬线字体可以消除粗体字体

使用两种不同的无衬线字体可以消除粗体字体

假设我想让我的文档使用默认的无衬线字体,但有时我希望文档中的其他一些功能使用不同的字体。我使用\usepackage{libertine}加载此其他字体,并使用 显示 libertine 字体\textsf{...}

但是,现在\textbf{}文档中不再使用默认无衬线字体加粗功能。我该如何解决这个问题?

编辑:我发现了这个问题。问题出在以下有问题的代码行:

\renewcommand\rmdefault{cmss}

我把它改成了

\renewcommand{\familydefault}{cmss}

在下面的 MWE 中,一切运行正常。

MWE(找到解决方案):

\documentclass[11pt]{article}

%% Import packages
%% ================================================================================================
\usepackage[numbers,sort&compress]{natbib}                      % Enable bibtex
\usepackage[hyphens]{url}
\usepackage[pdftex]{graphics,graphicx}  % Augment graphics functionality
%\usepackage{concrete}                  % Concrete roman font -- COOL MATH. This package has some conflicts with fancyhdr. Recommend not to use.
\usepackage{latexsym}                   % Symbolic fonts for LaTeX
\usepackage{amsmath}                    % AMS math formatting options
\usepackage{amsfonts}                   % AMS fonts
\usepackage{bm}                         % Bold math
\usepackage[normalem]{ulem}
\usepackage{commath}
\usepackage[tiny,compact]{titlesec}     % Allow better control over sections, headers, etc.
\usepackage{fancyhdr}                   % Allow better control over page layout
\usepackage[section]{placeins}  % Keep figures in section
\usepackage{float}                      % Define tables and floating elements
\usepackage{flafter}                    % Never put floats before their references
\usepackage{floatflt}                   % wrap text around floats
\usepackage{wrapfig}                    % wrap text around figures
\usepackage{subcaption}                     % subcaptions for subfigures. USE SUBFIG, NOT SUBFIGURE. SUBFIGURE IS DEPRECATED AND MAY CONFLICT WITH OTHER PACKAGES
\usepackage{longtable}                  % A multi-page tabular environment
\usepackage{threeparttable}             % tables with footnotes, capions all the same width
\usepackage{dcolumn}                    % decimal-aligned tabular math columns
\usepackage{multirow}                   % Allow table cells to span multiple rows
\usepackage{booktabs}                   % Formatting options for publication-quality tables
\usepackage{array}                      % Additional options for formatting columns in the array and tabular environments
\usepackage{caption}                    % Caption formatting -- use commands here instead of hangcaption
\usepackage[usenames,dvipsnames]{color}                     % Enable colors
\usepackage[table,hyperref]{xcolor}     % Better control over color
\usepackage{import}                     % Let latex import files from different directories
\usepackage{datetime}                   % Format dates and times
\usepackage{enumitem}                   % Better control over lists
\usepackage{nomencl}                    % nomenclature package
\usepackage{lscape}                     % Allow text to be written in landscape mode
\usepackage{lipsum}                     % Lorem Ipsum, for placeholder text.
\usepackage[greek,english]{babel}
\usepackage[sort&compress]{natbib}
\usepackage{setspace}

%\usepackage{cabin}
\usepackage{libertine}
\usepackage[T1]{fontenc}
%\renewcommand*\familydefault{\sfdefault}  %% Only if the base font of the document is to be sans serif


\usepackage[colorlinks=true, linkcolor=DarkBlue, citecolor=DarkBlue, urlcolor=DarkBlue, breaklinks=true]{hyperref}  % Allow for hyperlinks in documents. THIS MUST ALWAYS BE LAST
\usepackage[nameinlink]{cleveref}

\usepackage{fancyvrb}

\renewcommand{\familydefault}{cmss}



\newlength{\tempintextsep}

\begin{document}

\setlength{\tempintextsep}{\intextsep}
\setlength{\intextsep}{0pt}
\begin{wrapfigure}[6]{l}{2.4in}
{
\setlength{\abovedisplayskip}{0pt}
$$
\left\{\;\;\;
\begin{minipage}{1.95in}
\centering
\fontsize{16pt}{19pt}\selectfont
\textsf{
This is a super awesome quote of super awesomeness.
}
\end{minipage}\;\;\;
\right\}
$$
}
\end{wrapfigure}

\lipsum[1]

\textbf{\lipsum[2]}
\setlength{\intextsep}{\tempintextsep}
\end{document}

答案1

当前的问题是,文档实际上并没有以无衬线字体书写,而是 rm 字体被无衬线字体覆盖。这会导致各种奇怪的行为。

我改为\renewcommand\rmdefault{cmss}\renewcommand{\familydefault}{cmss}现在一切似乎都运行良好。

相关内容