1

I am loading stringstrings package in my document and the double vertical bar \| (in math mode) is printed as |0 (single vertical bar followed by zero). I checked the stringstrings.sty file and noticed indeed the following lines

\def\PipeCode{0}
\def\EncodedPipe{\EscapeChar\PipeCode}
\def\Pipe{|}
\let\|\EncodedPipe

Below, two minimal working examples showing the issue.

\documentclass{article}
\begin{document}
Without {\tt stringstrings}: $\|$ \(\|\)
\end{document}

enter image description here

\documentclass{article}
\usepackage{stringstrings}
\begin{document}
With {\tt stringstrings}: $\|$ \(\|\)
\end{document}

enter image description here

I suppose stringstrings does it due to some string manipulation issues, but is there a way to restore the original symbol, compatibly with the purposes of the package? Besides, are there any other redefinitions I should be aware of?

Edit: I sort of fixed the issue by redefining the command \| myself in the preamble:

\let\doublebar\|
\usepackage{stringstrings}
\def\|\doublebar

but I am afraid it might clash with the package. Moreover, page 16 of the manual lists (some of?) the redefinitions, but I couldn't understand how the thing is supposed to be fixed.

  • 1
    Sorry, I did that package when I was young and foolish, which is to say, before I knew about this site. – Steven B. Segletes Jan 11 '18 at 14:01
  • 2
    You shouldn't be using \| anyhow: \lVert and \rVert are better (they need amsmath). On the other hand, there are alternatives to stringstrings. – egreg Jan 11 '18 at 14:06
  • Thanks @egreg, I am in fact loading xstring as well, but due to some issues with expansion and my not-so-high expertise with TeX hacks I found stringstrings package very useful for what I was looking for. – AndreasT Jan 11 '18 at 14:18
  • @AndreasT Maybe you can ask about those issues. – egreg Jan 11 '18 at 14:19
2

You can "save" the definition of \| before you load the stringstrings package using, for example, \let\pipe\|. After loading stringstrings you can now use \pipe instead of \|.

Here's a complete MWE:

\documentclass{article}
\let\pipe\|
\usepackage{stringstrings}
\begin{document}
With {\tt stringstrings}: $\|$ \(\|\) $\pipe$
\end{document}

which produces:

enter image description here

After loading stringstrings you could put \let\|\pipe but this could, conceivably, break something defined by stringstrings so I suggest using \pipe instead. Instead of \pipe you can, of course, call this anything you like - although I'd recommend avoiding existing LaTeX command names. For example, \let\cow\| would work equally well.

  • Thanks @Andrew for your prompt reply, this is what I also thought. I just find it difficult to convince the other co-authors to type \pipe or \cow :) in place of \|, so I guess I'll take the risks of directly redefining \|. – AndreasT Jan 11 '18 at 14:14
  • @AndreasT Pity, \cow has a certain appeal... – Andrew Jan 11 '18 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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