4

Is there way so that one can replace By Theorem \ref{theo1} by By \ref{theo1} without changing output in the following document:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{amsmath}


\newtheorem{theorem}{Theorem}

\begin{document}

\begin{theorem}\label{theo1}
I exist.
\end{theorem}


By Theorem \ref{theo1}, I exist.

\end{document}
2

1 Answer 1

4

The cleveref package provides the macro \cref, which does what you're looking for.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath,amsthm}
\usepackage[noabbrev,capitalize]{cleveref}
\newtheorem{theorem}{Theorem}

\begin{document}
\begin{theorem}\label{theo1}
I think.
\end{theorem}
\begin{theorem}\label{theo2}
I think some more.
\end{theorem}

By \cref{theo1}, I exist.

By \cref{theo1,theo2}, I exist some more.
\end{document}
1
  • Just ve aware if the problems regarding using shared counters
    – daleif
    Commented Apr 12, 2015 at 15:19

You must log in to answer this question.

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