1

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

\newtheorem{Th}{Теорема}[chapter]
\newtheorem{Tv}[Th]{Твърдение}

(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.

\documentclass{report}
\usepackage[cp1251]{inputenc}
\usepackage[bulgarian]{babel}
\usepackage{sidecap}
\usepackage{graphicx}
\usepackage{amsmath,amssymb,latexsym,eucal}
\usepackage{mathrsfs}
\usepackage{amsfonts}
\usepackage{wrapfig}
\usepackage{amscd}
\usepackage{appendix}
\usepackage[all]{xy}
\usepackage{xcolor}
\usepackage{hyperref} 
\hypersetup{
colorlinks,
linkcolor={blue!90!black},
citecolor={blue!60!black},
urlcolor={blue!90!black}
}
\usepackage{epstopdf} 
\usepackage{multirow} 
\usepackage{float} 
\usepackage{tikz} 
\usepackage{tikz-cd}
\usetikzlibrary{matrix,arrows,decorations.pathmorphing}
\usetikzlibrary{3d,calc}
\usepackage{pgfplots} 

\newtheorem{Th}{Theorem}[chapter]
\newtheorem{Tv}[Th]{Proposition}
\begin{document}
\begin{Th}\label{myProp}
The equation 
\begin{equation}\label{myEq}
x^2y+e^z-\sin{t} = 0.
\end{equation}
has a solution.
\end{Th}

\begin{Th}\cite{X}
The solutions for the equation defined in Proposition \ref{myProp} are
\[
\ldots
\]
\end{Th}



\begin{thebibliography}{999}\itemsep=-.2pc
\bibitem{X} Author X. Paper Y. Year Z.
\end{thebibliography}

\end{document}
4
  • 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. Commented Aug 22, 2016 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
    Commented Aug 22, 2016 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. Commented Aug 22, 2016 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
    Commented Aug 22, 2016 at 17:08

2 Answers 2

2

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

1
  • 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
    Commented Aug 22, 2016 at 17:59
4

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:

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

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

\makeatletter
\def\ref#1{\expandafter\@setref\csname r@#1\endcsname
    \@firstoftwo{\textup{#1}}}
\def\pageref#1{\expandafter\@setref\csname r@#1\endcsname
                                   \@secondoftwo{\textup{#1}}}
\makeatother
5
  • The command for \cite worked for me, but the command about \ref didn't.
    – Veliko
    Commented Aug 22, 2016 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.) Commented Aug 22, 2016 at 17:39
  • I made a working example that probably would work for me, see edit of the original post.
    – Veliko
    Commented Aug 22, 2016 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
    Commented Aug 24, 2016 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. Commented Aug 24, 2016 at 12:08

You must log in to answer this question.

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