Remove brackets from a single citation (without natbib)

How to remove brackets around a specific citation in the text:

See [1] and [2], but 3 is what I need, and [4] is ok.


Here, what command would give 3 and not [3] as \cite gives? For the other citations in the same document, brackets like [1] are OK.

This is not a duplicate of "Remove brackets from a single citation" because the command \citenum recommended there needs an additional package (probably natbib).

My motivation is citing two papers, each with page numbers. It seems it is impossible using normal citing commands:

See [1, p 12] and [2, p 23], but [3, p 34; 5, p 45] is what I need, and [4, p 56] is ok


so I expect to simulate it with commands like

See \cite[p 12]{A} and \cite[p 23]{B},
but [\citeNoBrackets[p 34]{C}; \citeNoBrackets[p 45]{E}] is what I need,
and \cite[p 56]{D} is ok.


For this, I need a command like \citeNoBrackets that behaves as \cite but does not add brackets. How do I do it?

Note: \def\@biblabel#1{#1} does just the opposite: it changes the References list, but does not change how citations appear in the text.

MWE:

\documentclass{article}
\begin{document}
See \cite[p 12]{A} and \cite[p 23]{B},
but [\cite[p 34]{C}; \cite[p 45]{E}] is what I need,
and \cite[p 56]{D} is ok.
\bibliographystyle{plain}
\bibliography{test}
\end{document}


test.bib:

@Article{A, author = {A}, title = {A}, journal = {A}, year = {A}}
@Article{B, author = {B}, title = {B}, journal = {B}, year = {B}}
@Article{C, author = {C}, title = {C}, journal = {C}, year = {C}}
@Article{D, author = {D}, title = {D}, journal = {D}, year = {D}}
@Article{E, author = {E}, title = {E}, journal = {E}, year = {E}}


which produces

See [1, p 12] and [2, p 23], but [[3, p 34]; [5, p 45]] is what I need, and [4, p 56] is ok.


with unwanted double brackets.

• Why do you not want to use natbib? It is very widely used and accepted by publishers. Aug 4 '17 at 12:34
• natbib was created to do what you want. Where is the problem? Aug 4 '17 at 12:42
• I am not sure if it will not alter a given style. In addition, I cannot get it working with the particular style I have to use, svjour3.cls. Aug 4 '17 at 12:42
• A minimal working example with bibliography (MWEB), that illustrates your problem would help a lot. Aug 4 '17 at 12:51
• The svjour3.cls has a natbib option, so it's definitely compatible with natbib. You're asking people to reinvent the wheel. Aug 4 '17 at 13:00

Lightly tested.

\documentclass[]{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}

@book{Knuth1984texbook,
Author = {Knuth, D.E.},
Title = {The TEXbook, volume A of Computers and typesetting},
Year = {1984}}

@book{Chomsky1965,
Author = {Noam Chomsky},
Publisher = {{MIT} Press},
Title = {Aspects of the Theory of Syntax},
Year = {1965}}
\end{filecontents*}

\bibliographystyle{plain}
\makeatletter
\newif\ifnobrackets
\renewcommand\@cite[2]{\ifnobrackets\else[\fi{#1\if@tempswa , #2\fi}\ifnobrackets\else]\fi\nobracketsfalse}
\newcommand\nbcite{\nobracketstrue\cite}
\makeatother

\begin{document}
[\nbcite[p.4]{Knuth1984texbook} and \nbcite[p.5]{Chomsky1965}] show that ...
\cite[p.4]{Knuth1984texbook} and \cite[p.5]{Chomsky1965} show that ...
\bibliography{\jobname}
\end{document}


• I wonder whether the same effect cannot be achieved by just removing the first and last character from the result of \cite. Aug 4 '17 at 14:57
• @AlexanderGelbukh I've simplified the code. Aug 4 '17 at 17:20