Entornos con fuente predeterminada, otros textos como \textsf

Entornos con fuente predeterminada, otros textos como \textsf

Me gustaría establecer la fuente de un documento como la producida por \textsf{}, pero mantener la fuente predeterminada en entornos como definiciones y teoremas. Mi intento de declarar

\documentclass[a4paper,12pt]{book} 
\usepackage{amsthm}
\renewcommand{\familydefault}{\sfdefault}
\newtheorem{defi}{Definition}[chapter]
\newtheoremstyle{defi}% name
{3pt}% Space above
{3pt}% Space below
{crm}% Body font
{}% Indent amount
{\itshape}% Theorem head font
{:}% Punctuation after theorem head
{.5em}% Space after theorem head
{}% Theorem head spec (can be left empty, meaning ‘normal’)

\begin{document}

\begin{defi} Text with default font. \end{defi}

Text in sans-serif font.

\end{document}

Pero no funciona, ya que la fuente está definida como sans-serif en todo el texto. Me pregunto si la fuente del cuerpo que mencioné anteriormente es correcta. Si alguien pudiera darme una pista se lo agradecería. Me aconsejaron que no utilizara esta fuente sans-serif para componer mi documento. Entonces, me gustaría algunas sugerencias. ¡Gracias de antemano!

Respuesta1

Hay al menos un par de problemas:

  • la fuente debe especificarse como \rmfamily, no como cmr;

  • debes invocar tu nuevo estilo antes de la \newtheoremdeclaración.

Prueba esto:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{amsmath,amsthm}

\renewcommand{\familydefault}{\sfdefault}

\newtheoremstyle{defi}% name
    {3pt}% Space above
    {3pt}% Space below
    {\rmfamily}% Body font
    {}% Indent amount
    {\rmfamily\itshape}% Theorem head font
    {:}% Punctuation after theorem head
    {.5em}% Space after theorem head
    {}% Theorem head spec (can be left empty, meaning "normal")

\theoremstyle{defi}
\newtheorem{defi}{Definition}[section] % not "chapter" because I'm using the 
                                       % "article" document class



\begin{document}

\section{A title}

Some text before the first definition: this text should be in ``sans-serif''.

\begin{defi}
    This is a definition, and it should be in \verb|\rmfamily| (that is, 
    \emph{with} serifs).
\end{defi}

Some text after the definition, again in \verb|\sffamily|.

\end{document}

Puedes comprobar por ti mismo que el resultado es simplemente una tipografía deficiente:

Salida del código

De hecho, componer un artículo (o, peor aún, un informe: estabas usando capítulos, ¿no?) en fuentes sans-serif ya es cuestionable en sí mismo; pero para configurar,dentrotal documento, las definiciones con serifas…

información relacionada