I have a LaTeX source file that produces a nice visual layout that I like, and want to keep. I want to be able to generate a PDF file with links to external URLs, and ideally also an HTML file with similar visual appearance and the same links, automatically generated from that LaTeX source file, if possible.
A file that is nearly the same as the original file has been uploaded as an attachment called latex-community-question-2-href-error.tex
If you replace the \href{ ... }{ ... } in that file with just zero?, you will have the original file, which has no errors during LaTeX processing, and using dvipdfm produces a nice PDF file, but with no links.
If you keep the file as is, latex gives an error near the } that closes the \colouredbox{grey}{ ... } around the \href.
While experimenting, I have found that if you remove the # from the URL, latex gives no errors, and dvipdfm produces a PDF file with a link, but of course it is not the link I want. But at least it can make some kind of link.
If I remove the \colouredbox{ }, the \tabularx (and the & symbols that were in the \tabularx), the \cmd, and the \frenchspacing from around the \href, latex gives no errors and I can produce a PDF file with the desired link, but then the visual layout is completely changed to something I don't want.
I've tried variations with \protect in a few places near the \href, but without any success.
Does anyone know a way to keep the combination of visual formatting, and URLs with # using hyperref?
Is there another package besides hyperref I should try?
Thanks for any help you can provide.
Graphics, Figures & Tables ⇒ Some combo of href with # in URL, tabularx etc causes errors
-
- Posts: 1
- Joined: Sun Feb 20, 2011 12:06 am
Some combo of href with # in URL, tabularx etc causes errors
- Attachments
-
- latex-community-question-2-href-error.tex
- (14.49 KiB) Downloaded 249 times
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 126
- Joined: Sun Feb 13, 2011 8:36 pm
Some combo of href with # in URL, tabularx etc causes errors
Escape the # by using \# instead. If I do so, the document is typeset correctly and the hyperlink works.
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).