2

Say I want to have my document in the default sans serif font, but I occasionally wish to have some other features in the document be in a different font. I am using \usepackage{libertine} to load this other font, and I get the libertine font to show up by using \textsf{...}.

However, now \textbf{} no longer works in the document to bold the default sans serif font. How can I work around this?

Edit: I found the issue. The problem was the following offending line of code:

\renewcommand\rmdefault{cmss}

I changed this to

\renewcommand{\familydefault}{cmss}

in the MWE below, and all works fine.

MWE (solution found):

\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
    As described, this sounds odd. Please provide a minimal example (or here). – jon Sep 13 '13 at 19:40
  • @jon I've fixed the issue while paring down my code to generate the MWE :) – Emily Sep 13 '13 at 19:59
  • It often does! BTW, I'd watch out for spurious spaces if you use \textsf{ <text> }; it should really be \textsf{<text>}. (Perhaps you were just trying to draw attention to its use, however....) – jon Sep 13 '13 at 20:07
  • @jon Indeed; this was just spurious extra space induced when I replaced the quote that will appear in my actual document. – Emily Sep 13 '13 at 20:27
0

The issue at hand was that the document wasn't actually being written as sans serif, it was that the rm font was overridden with a sans serif font. This cause all sorts of funky behavior.

I changed \renewcommand\rmdefault{cmss} to \renewcommand{\familydefault}{cmss} and everything seems to be working just fine now.

  • 1
    Now, try to do Text \textrm{is not text}, I can't test now but I suppose that they would come in different fonts. Wouldn't they? – yo' Sep 13 '13 at 21:21
  • The Community has owned your question. If you're happy with your own answer then you should select it. That way it will not continue to be seen as a question without an accepted answer. – Geoff Pointer Dec 12 '13 at 22:30
  • @GeoffPointer I meant to do that, but forgot :) – Emily Dec 12 '13 at 22:39
  • The next thing is to find out how to get Community to give ownership back to you. That I don't know. You could hit the contact us link below. They'll know what to do. – Geoff Pointer Dec 12 '13 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.