0

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.

6
  • 1
    If I add \usepackage{xcolor} and \newtheorem{thr}{\textcolor{blue}{Theorem}}[section] to the provided example file, there is no problem at all.
    – egreg
    Commented Nov 23, 2018 at 14:21
  • What's the error you get?
    – egreg
    Commented Nov 23, 2018 at 14:35
  • @egreg Thank you very much, it works perfectly.
    – QGravity
    Commented Nov 24, 2018 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
    Commented Nov 25, 2018 at 2:35
  • Well, yes, but it's by chance.
    – egreg
    Commented Nov 25, 2018 at 9:44

1 Answer 1

1

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{[email protected]}
\emailAdd{[email protected]}
\emailAdd{[email protected]}
\emailAdd{[email protected]}

\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}

enter image description here

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .