[Tex/LaTex] Custom theorem numbering italicized

numberingtheorems

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.

Best Answer

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