8

I am getting bitten by the same problem from one of my previous questions: tildes are not handled properly. But now it's the PSTricks QR code package that's not working, and none of the suggestions from the other question are working. Here's an example:

\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-barcode}
\begin{document}
\begin{pspicture}(2cm,2cm)
\psbarcode{http://example.com/~user}{}{qrcode}
\end{pspicture}
\end{document}

When I put the result into a QR decoder, I get

http://example.com/protect unhbox voidb@x penalty @M  {}user

...which is exactly the problem I had before. But neither \textasciitilde nor \~ works; both insert weird extra bits into the file.

I can work around this instance by using a URL shortener, but really I'd like to know how to teach PSTricks the same tilde-handling magic that hyperref knows.

12

\psbarcode{http://example.com/\string~user}{}{qrcode}

\string makes the active character ~ to an inactive one.

  • Perfect. It also works with #. – Sigur Jul 20 '15 at 12:49

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.