3

In Custom theorem numbering @egreg gave us a way to put custom labels on theorems. However, when I compile my latex document with that new command, the text of the theorem is in regular text. If I want it to be in italicized text, how should I modify the command?

EDIT: At the top of my latex document, I have

\documentclass[11pt]{article}
\renewcommand{\baselinestretch}{1.05}
\usepackage{amsmath,amsthm,verbatim,amssymb,amsfonts,amscd, graphicx,tikz}
\usetikzlibrary{calc, shapes, cd, backgrounds}
\usepackage{graphics}
\usepackage{titlesec}

\setcounter{secnumdepth}{4}

\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\topmargin0.0cm
\headheight0.0cm
\headsep0.0cm
\oddsidemargin0.0cm
\textheight23.0cm
\textwidth16.5cm
\footskip1.0cm
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\newtheorem{lemma}{Lemma}
\newtheorem{proposition}{Proposition}
\newtheorem{conjecture}{Conjecture} 
\newtheorem*{question}{Question} 
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\newtheorem*{remark}{Remark}
\newtheorem*{example}{Example}
\newtheorem{problem}{Problem}
\newtheorem{exercise}{Exercise}

\newtheorem{innercustomthm}{Theorem}
\newenvironment{customthm}[1]
{\renewcommand\theinnercustomthm{#1}\innercustomthm}
{\endinnercustomthm}
\begin{document}

Then, when I insert a theorem using "\begin{theorem}," the compiled version is italicized. Now, I wanted to use the custom numbering system outlined in the link. But when I followed that answer, the resulting text is not italicized.

If I write

\begin{theorem}
This is a theorem.
\end{theorem}

I get

Theorem 1. This is a theorem.

But if I type the newcommand at the top

\newtheorem{innercustomthm}{Theorem}
\newenvironment{customthm}[1]
{\renewcommand\theinnercustomthm{#1}\innercustomthm}
{\endinnercustomthm}

and then I type

\begin{customthm}{1.1}
This is a theorem.
\end{custom}

I get

Theorem 1.1. This is a theorem.

I want the body of the text to be italicized.

EDIT 2: I added the header of the document. Sorry about my ignorance-I copied the header from a template but I don't know the details about how to tweak it.

  • If I recompile the very example, I get the text of the theorem in italics. Maybe you have \theoremstyle{definition} before declaring the new theorem? – egreg Jan 5 '16 at 17:30
  • @egreg: I think the O.P. means the numbering which is not in italics – user31729 Jan 5 '16 at 19:15
  • 1
    Please, clarify your request. – egreg Jan 5 '16 at 20:24
  • Sorry, but I dont' get this. Please, add a minimal example starting from \documentclass and ending with \end{document}. – egreg Jan 7 '16 at 9:58
  • 1
    Move the four lines preceding \begin{document} before the line \theoremstyle{definition}. That's all. – egreg Jan 8 '16 at 23:47
2

The issue is that the most recent \theoremstyle call before \newtheorem{innercustomthm}{Theorem} is \theoremstyle{definition}, so innercustomthm takes on the style of a definition, i.e. upright text. You can fix this by moving \newtheorem{innercustomthm}{Theorem} before all of your other theorem declarations, which will give it the default italic style.

For example:

\documentclass[11pt]{article}
\usepackage{amsmath,amsthm}

\newtheorem{innercustomthm}{Theorem}

\theoremstyle{plain}
 % ... other theorem declarations (same as before)
\newtheorem{exercise}{Exercise}

\newenvironment{customthm}[1]
{\renewcommand\theinnercustomthm{#1}\innercustomthm}
{\endinnercustomthm}
\begin{document}
\begin{customthm}{1.1}
This is a theorem.
\end{customthm}
\end{document}

enter image description here

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.