Text FormattingGet value of ref argument

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
yiorgosb
Posts: 30
Joined: Mon Aug 02, 2010 11:56 pm

Get value of ref argument

Post by yiorgosb »

I have been given a book where the key of many references has been replaced with the real value.

For example instead of \ref{chonertwo} it writes \ref{1-2} (referencing to equation 1-2).
Of course this results to an error of missing reference.

Is there any way to trick latex to ignore the argument and to display only the value of?
Or I have to get used to the idea that I need to change every ref occurrence in the entire book?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Get value of ref argument

Post by sommerfee »

yiorgosb wrote:Is there any way to trick latex to ignore the argument and to display only the value of?
You could simply redefine \ref so it will just printout its value, e.g.:

Code: Select all

\renewcommand\ref[1]{#1}
or

Code: Select all

\renewcommand\ref[1]{\textit{#1}}
or whatever you want.
yiorgosb
Posts: 30
Joined: Mon Aug 02, 2010 11:56 pm

Get value of ref argument

Post by yiorgosb »

sommerfee wrote:
yiorgosb wrote:Is there any way to trick latex to ignore the argument and to display only the value of?
You could simply redefine \ref so it will just printout its value, e.g.:

Code: Select all

\renewcommand\ref[1]{#1}
or

Code: Select all

\renewcommand\ref[1]{\textit{#1}}
or whatever you want.
Thanks.
That will definitely make my life easier.
However, there are still some \ref{} which contain actual references.

So the question now is, if there's a way to identify if a character is numerical or number so to determine which \ref{} it is. Something like
if{isnum{x}}
renewcommand
else
act normal
Post Reply