Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Suppose, I want to add a \bullet just before every reference(like this). How can I do that?

EDIT: Say, I use a \ref{key}, when the \label{key} points to a section, it is shown only as a number:

\documentclass{article}

\begin{document}
abc \ref{key}

\section{something \label{key}}
xyz 
\end{document}

Now, assume I want to put a \bullet before the number. What should I do?

I had some random tests with \renewcommand, but none of them succeeded.

share|improve this question
    
Do you mean citation or a reference of an equation? Please provide a complete minimal working example. –  Marco Daniel Feb 2 at 14:25
add comment

1 Answer 1

up vote 6 down vote accepted

If you want this result every time you use \ref you can do the following:

\let\oldref\ref
\renewcommand{\ref}{\textbullet\oldref}

MWE (note that the \label goes outside the \section)

\documentclass{article}

\let\oldref\ref
\renewcommand{\ref}{\textbullet\oldref}

\begin{document}
abc \ref{key}

\section{something}\label{key}
xyz
\end{document} 

Output:

enter image description here

If you are loading hyperref, this package redefines the command \ref at the beginning of the document, so if you want to work in this case you have to substitute the above lines with:

\AtBeginDocument{%
  \let\oldref\ref%
  \renewcommand{\ref}{\textbullet\oldref}%
}
share|improve this answer
    
Well, that worked for the MWE, but not for my original document. –  pushpen.paul Feb 2 at 15:39
    
@pushpen.paul Then add something in your MWE that can interfere with it. –  karlkoeller Feb 2 at 15:41
2  
\usepackage{hyperref} \AtBeginDocument{\let\oldref\ref\renewcommand{\ref}{\textbullet\oldref}} –  Marco Daniel Feb 2 at 15:57
    
Using Marco Daniel's update, it works. –  pushpen.paul Feb 2 at 16:08
    
@MarcoDaniel Thanks for the comment, I was outdoor and I'm seen it now. –  karlkoeller Feb 2 at 18:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.