1

It seems to be impossible to use any TikZ packages in the JHEP class (theoretical high energy physics: link)

The clash seems to be that JHEP does not like colors (except for the classical ones blue, green, red, etc). Still, I need to make commutative diagrams.

Does anyone know how to either

1) Combine TikZ and JHEP style

or

2) Write NICE commutative diagrams on a different way than TikZ?

P.S. The error I get is:

! Undefined control sequence.
\set@color ...\@pdfcolorstack push{\current@color
}\aftergroup \reset@color

P.S.2 This is the code I use and fails to work with TikZ:

\RequirePackage{ifpdf}
\documentclass[12pt,letterpaper]{JHEP3}



\usepackage{amscd,amsmath,amssymb,amsfonts,xspace,mathrsfs}
\usepackage[utf8]{inputenc}
\usepackage{tikz-cd}
%\usetikzlibrary{cd}
% \usetikzlibrary{arrows,intersections}
% \usepackage{lipsum}
% \usepackage{setspace}
\usepackage{graphicx}
 \title{Some Title}
%    Remove any unused author tags
%    author one information 
\author{Author 1 and Author 2\\
{\it Some University}\\

\vspace*{2mm} {\tt e-mail:
\email{author1@somewhere.com}, 
\email{author2@somewhere.com}}
}

\abstract{ Abtract for JHEP.} 


\preprint{}


\begin{document}

Hi. This is a test.

\end{document}
TeXnician
  • 33,589
Gorbz
  • 151
  • 6
    It would be nice if you could show an example of what fails. – Torbjørn T. May 16 '18 at 13:57
  • 3
    If by "clash" you mean you get an option clash error, my guess would be that it's because you load color with options (e.g. \usepackage[usenames]{color}) after loading jheppub. Because jheppub loads color without options, that causes an error, similar to https://tex.stackexchange.com/questions/51488/. But without more details about what you did, this is pure guesswork. – Torbjørn T. May 16 '18 at 14:08
  • 1
    In principle you can also compile the diagram as standalone and include it as graphics. –  May 16 '18 at 14:25
  • @marmot indeed, but I prefer to have it as code within the file. – Gorbz May 16 '18 at 20:42
  • @TorbjørnT. Thank you. I do not use the command \usepackage{jheppub}, rather I only use \documentclass[12pt,letterpaper]{JHEP3} and that's it. (I apologize, I do not know how to insert code in comments). The error I get I will put it on the main question above. – Gorbz May 16 '18 at 20:47
  • And where exactly can JHEP3.cls be found? In the link you provided only the jheppub package is to be found. – Torbjørn T. May 16 '18 at 20:49
  • @TorbjørnT. Here I think. –  May 16 '18 at 20:51
  • 2
    I suspect the answer to this is "follow the instructions given by the journal". In other words, don't use the JHEP3 class, but the jheppub package, as instructed on the journal page. Further, if I use the class from the link given by @marmot, and do \documentclass[12pt,letterpaper]{JHEP3} \author{..} \abstract{..} \title{..} \begin{document} foo \end{document} I do not get the error you mention. So if you want a sure answer for what happens, please add a complete example of code that produces the error, and a link to the class. – Torbjørn T. May 16 '18 at 21:00
  • @TorbjørnT. I agree with what you are saying and would like to add that one can submit a paper by just specifying the arXiv number. In principle, the arXiv submission does not have to use any of the JHEP stuff, but the jheppub package allows you to get a feeling for how the thing will look like when it gets published. –  May 16 '18 at 21:02
  • @TorbjørnT. Thanks, I will add something indeed. Also, yes, using marmot's code I do not get any problems whatsoever. But when I substitute {article} for {JHEP3} I do get some errors. – Gorbz May 17 '18 at 10:45
  • The class file is that found on marmot's link? If so, the problem in your example is completely unrelated to TikZ it seems, you can remove all the packages and the same error occurs, and I would guess the class file itself is buggy. I first get an error about \pdfannot being undefined, and after adding \usepackage{hyperref} some errors about \Hy@colorlink and similar being undefined. After that, if a color package is loaded, you get the error you mention in your question. If you google these errors, you might find that they occur when stuff is typeset in the preamble, ... (ctd.) – Torbjørn T. May 17 '18 at 11:15
  • for example via \AtBeginDocument. Which is why I think, without being able to accurately judge the code myself, that the class is poorly written, and has bugs. So I'm back to what I said earlier, don't use the class. – Torbjørn T. May 17 '18 at 11:17
  • This is super weird since I get absolutely no problem! Thanks for all the info, and in the future I will be using marmots template but, yeah, this is weird. – Gorbz May 17 '18 at 19:01

1 Answers1

3

Not really an answer but since I have used TikZ pictures in JHEP publications I just want to confirm Torbjørn T.s statement that it works.

\documentclass[a4paper,11pt,fleqn]{article}
\pdfoutput=1 % if your are submitting a pdflatex (i.e. if you have
             % images in pdf, png or jpg format)
\usepackage[utf8]{inputenc}
% from https://jhep.sissa.it/jhep/help/JHEP/TeXclass/DOCS/jheppub.sty
\usepackage{jheppub} % for details on the use of the package, please
                     % see the JHEP-author-manual
\usepackage{tikz-cd}                     
\title{\boldmath A JHEP article with Ti\emph{k}Z
\unboldmath}

\author[a]{Koala Bear}
\author[b,1]{and Marmot\note{Corresponding author.}}


\affiliation[a]{Eucalyptus tree}
\affiliation[b]{Marmot burrow}

% e-mail addresses: one for each author, in the same order as the authors
\emailAdd{koala@koalas.org}
\emailAdd{marmot@marmots.org}

\preprint{XXX-YYY}

\abstract{We use a Ti\emph{k}Z picture in a JHEP publication.}

\notoc
\begin{document}
\maketitle

\section{Introduction}

\begin{tikzcd}  
  & & I_1 \ar[rd] \arrow[loop above] & & \\
  & I_K \ar[ur] & & I_2 \ar[rd] & \\ 
  \makebox[14pt]{$I_{K-1}$} \ar[ur] & & & & \makebox[14pt]{$I_{3}$} \ar[d] \\
  \makebox[14pt]{$I_{K-2}$} \ar[u] & & & & \makebox[14pt]{$I_{4}$} \ar[ld]\\
  &~\ar[lu]& & ~\ar[ll,dashed, bend left]&\\
\end{tikzcd}    



\end{document}
\endinput

So you need to provide more details such that people can find out what the problem is, but most likely Tobjørn T. did that already.

  • Actually I confirmed your template is quite different than mine. I use JHEP-HYPER version and it looks slightly different (e.g. author's name is bigger). I have to admit I do not know very well the differences. – Gorbz May 16 '18 at 20:54