I am working with several theorem environments defined by me, for example


(the words are in Bulgarian, but it doesn't matter). In all these theorems and the proof environments I need to use both \cite and \ref.

What I want is an uniform rule that makes everything in \cite or \ref with normal text in all theorem environments. I don't want to use \textup or similar every time.

I am well aware of this and this posts but they don't resolve this issue globally.

Here is a working example that would work for me if resolved.


The equation 
x^2y+e^z-\sin{t} = 0.
has a solution.

The solutions for the equation defined in Proposition \ref{myProp} are

\bibitem{X} Author X. Paper Y. Year Z.

  • 1
    welcome to tex.sx. what theorem environment are you using? you don't show one here, so it is probably defined in the document class, which you don't show either. we need that information to derermine where changes would need to be made. – barbara beeton Aug 22 '16 at 15:38
  • @barbarabeeton Hello and thank you. My the package behind my document class is given to me by my scientific adviser and were asked not to share its code. However, the basic class that the package uses is {\it report }. I don't know what you mean by what theorem environment I use? You mean a concrete example in the text like \begin{theorem} The Scientst X showed in \cite{...} that ... \end{theorem} ? – Veliko Aug 22 '16 at 16:03
  • 1
    this may do it; not tested: \makeatletter \def\@cite#1#2{\textup{[{#1\if@tempswa , #2\fi}])} \makeatother (sorry for the mashed-together code. i don't like to post answers unless i'm sure the code works.) this modifies code from latex.ltx. if it works, i'll look up the definition of \ref. – barbara beeton Aug 22 '16 at 16:59
  • Thank you! It worked with \cite. By the way, you skipped one }, so the working form is : \makeatletter \def\@cite#1#2{\textup{[{#1\if@tempswa , #2\fi}])}} \makeatother – Veliko Aug 22 '16 at 17:08

There is a package available called upref, which is part of the AMS Classes distribution.

  • Adding \usepackage{upref} to the preumble solved the problem with the \ref in the theorem environments. I am also interested to see the solution with the redefinition of \ref without adding packages despite the fact that since upref is in the AMS Classes distribution it probably won't create future problems. – Veliko Aug 22 '16 at 17:59

since the underlying class file is report, and no theorem or bibliography packages are loaded, the place to look for definitions of \cite and \ref are in report.cls. as it happens, neither of those commands is defined there, so the next place to look is in latex.ltx, which underlies all of latex.

the definition for \cite is fairly complicated, and the relevant part is not in the "main" definition. looking for a "related" definition that contains the brackets and actually sets something, one finds \@cite, which can easily be "repaired" by adding \textup{...} around the part that prints:

\def\@cite#1#2{\textup{[{#1\if@tempswa , #2\fi}]}}

\ref is not done the same way, and this is not tested (i will do so later):

\def\ref#1{\expandafter\@setref\csname r@#1\endcsname
\def\pageref#1{\expandafter\@setref\csname r@#1\endcsname
  • The command for \cite worked for me, but the command about \ref didn't. – Veliko Aug 22 '16 at 17:32
  • 1
    okay. i will have to create a test, but i haven't time right now. (that's why on this site we ask for compilable examples; then we can start with something we can cut and paste.) – barbara beeton Aug 22 '16 at 17:39
  • I made a working example that probably would work for me, see edit of the original post. – Veliko Aug 22 '16 at 18:15
  • Actually the in the code about \cite there is one redundant ")" symbol which produces citations like "[37])". The correct one is \makeatletter \def\@cite#1#2{\textup{[{#1\if@tempswa , #2\fi}]}} \makeatother – Veliko Aug 24 '16 at 9:27
  • @Veliko -- thanks. (if you edit in a correction like this, where the code is clearly wrong, i would certainly accept it.) fixed. – barbara beeton Aug 24 '16 at 12:08

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.