I'm using the \nameref package and I need to obtain a labelled text within round brackets, but it adds some space before the right bracket, while it doesn't add space after the left bracket. Here is the MWE:
\documentclass[a4paper, 12pt]{article}
\usepackage{nameref}
\newcounter{mylabelcounter}
\makeatletter
\newcommand{\labelText}[2]{%
#1\refstepcounter{mylabelcounter}
\immediate\write\@auxout{%
%\string\newlabel{#2}{{1}{\thepage}{{#1}}{mylabelcounter.\number\value{mylabelcounter}}{}}
\string\newlabel{#2}{{1}{\thepage}{{\unexpanded{#1}}}{mylabelcounter.\number\value{mylabelcounter}}{}}
}%
}
\makeatother
\begin{document}
(\labelText{A}{label:textA})
\end{document}
How can I do to avoid the unwanted addition of space before the right bracket?
N.B. adding \hspace{-xpt} doesnt't works as the space added isn't fixed but depends on the type of letter.
Thank you!
Edit: I added the MWE
\labelText, perhaps I've missed some%character, but it could be some totally different code -- and that's the point: Which code are you using? Please post the minimal version of your document that shows this issue! – Jan 04 '17 at 23:58\labelTextdefined? – Werner Jan 04 '17 at 23:58%after\refstepcounter{mylabelcounter}– egreg Jan 05 '17 at 00:09\stringline, although it's not essential. – egreg Jan 05 '17 at 00:13%... – Jan 05 '17 at 00:16