# Define \newtheorem environment using jheppub.styt

I am using the JHEP style for writing a paper in latex. I would like to define new theorem\definition... environments, for example

\newtheorem{thr}{\color{Blue} Theorem}\numberwithin{thr}{section}

However, it seems that this specific style does not allow the definition of such environments. I am wondering whether there is any bypass for this problem.

• If I add \usepackage{xcolor} and \newtheorem{thr}{\textcolor{blue}{Theorem}}[section] to the provided example file, there is no problem at all. – egreg Nov 23 '18 at 14:21
• What's the error you get? – egreg Nov 23 '18 at 14:35
• @egreg Thank you very much, it works perfectly. – QGravity Nov 24 '18 at 1:20
• @egreg Just a point. When I used \textcolor{blue}{Theorem} I get something that like Theorem 1.1 in which only the word Theorem is blue. When I use just \color{...}, the number appears in blue as well. – QGravity Nov 25 '18 at 2:35
• Well, yes, but it's by chance. – egreg Nov 25 '18 at 9:44

## 1 Answer

Here is an example from their package, just define your new theorem and use it as follows. Note that \textcolor{blue}{Theorem} is better than {\color{blue} Theorem} and note also the blue with lowercase b.

\documentclass[a4paper,11pt]{article}
\pdfoutput=1 % if your are submitting a pdflatex (i.e. if you have
% images in pdf, png or jpg format)

\usepackage{jheppub} % for details on the use of the package, please
% see the JHEP-author-manual
\usepackage[T1]{fontenc} % if needed

\title{\boldmath A title with some math: $x=1$}

% more complex case: 4 authors, 3 institutions, 2 footnotes
\author[a,b,1]{F. Irst,\note{Corresponding author.}}
\author[c]{S. Econd,}
\author[a,2]{T. Hird\note{Also at Some University.}}
\author[a,2]{and Fourth}

% The "\note" macro will give a warning: "Ignoring empty anchor..."
% you can safely ignore it.

\affiliation[a]{One University,\\some-street, Country}
\affiliation[b]{Another University,\\different-address, Country}
\affiliation[c]{A School for Advanced Studies,\\some-location, Country}

% e-mail addresses: one for each author, in the same order as the authors
\emailAdd{first@one.univ}
\emailAdd{second@asas.edu}
\emailAdd{third@one.univ}
\emailAdd{fourth@one.univ}

\newtheorem{thr}{\color{blue} Theorem} \numberwithin{thr}{section}

\abstract{Abstract...}

\begin{document}
\maketitle
\flushbottom

\section{Some examples and best-practices}
\label{sec:intro}

\begin{thr}
Let $f$ be a function whose derivative exists in every point, then $f$
is a continuous function.
\end{thr}

\end{document}

• \color{blue} Theorem is not really correct: \textcolor{blue}{Theorem} is right. – egreg Nov 23 '18 at 14:26
• Yes, \textcolor{blue}{Theorem} is better, but I left the OP code for easy comparison with his/her non-working code. – AboAmmar Nov 23 '18 at 14:34
• Also \numberwithin{thr}{section} is dubious: it's much simpler to use the proper syntax: \newtheorem{\textcolor{blue}{Theorem}}[section]. – egreg Nov 23 '18 at 14:36