Text FormattingFormatting for Text inside a Theorem

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
laailalalaa
Posts: 35
Joined: Thu Oct 27, 2011 5:31 pm

Formatting for Text inside a Theorem

Post by laailalalaa »

Hello,

I defined an example "placeholder" using \newtheorem:

Code: Select all

\newtheorem{example}{Example}
If I write an example like this:

Code: Select all

\begin{example}[spheresmusic]
Consider s is a sphere so that ... .
\end{example}
How can I make the "s" look straight, how can I cancel the italic formatting just for some words in the example?


Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Formatting for Text inside a Theorem

Post by cgnieder »

Here's a couple of ways:

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\newtheorem{example}{Example}
\newcommand*\variable[1]{\textup{#1}}
\begin{document}

% emphasized:
\begin{example}[spheresmusic]
 Consider \emph{s} is a sphere so that ... .
\end{example}

% upright:
\begin{example}[spheresmusic]
 Consider \textup{s} is a sphere so that ... .
\end{example}

% semantically marked:
\begin{example}[spheresmusic]
 Consider \variable{s} is a sphere so that ... .
\end{example}

\end{document}
Regards
site moderator & package author
laailalalaa
Posts: 35
Joined: Thu Oct 27, 2011 5:31 pm

Re: Formatting for Text inside a Theorem

Post by laailalalaa »

Works great, thanks a lot.
Post Reply