4

How do I put a \url{} in a \marginnote{} without error using tufte-book document? I have already tried \marginnote{\url{http}} but I get the error illegal parameter number in definition of ...

1
  • 5
    The following: \documentclass{tufte-book} \begin{document} AAA \marginnote{\url{http}} \end{document} works OK (pdflatex, MikTeX). Additional information, in particular MWE, is needed. Dec 9, 2013 at 6:43

2 Answers 2

3

Remarks

It seems to work fine, if you load the url package. You need to escape special symbols like $, % or # using a preceeding \, as in \#. See also th example.

Implementation

\documentclass{tufte-book}
\usepackage{lipsum}
\usepackage{url}
\begin{document}
\lipsum[1]
\marginnote{\url{http://tex.stackexchange.com/questions/149105/tufte-style-book-url-in-marginnote/149133\#149133}}
\lipsum[1]
\end{document}

Output

enter image description here

5
  • 2
    I think the OP has got some illegal characters like # in the real url... Dec 9, 2013 at 11:39
  • No it doesn't. See how third line it overflows because of the dashes (-) if you keep on adding more dashes it won't wrap.
    – user14492
    Apr 2, 2018 at 21:13
  • @user14492 \usepackage[hyphens]{url} Apr 2, 2018 at 21:21
  • Now I get option clash for url...
    – user14492
    Apr 2, 2018 at 21:29
  • 1
    @user14492 \PassOptionsToPackage{hyphens}{url} before \documentclass Apr 2, 2018 at 21:32
2

It works partially when you make a citation of the style \cite{some-citation}. I found it much better to use the call to \url{} inside the bibliography document as opposed to the call. It wraps the long URL just fine in the margin notes.

Example:

@misc{codebook,
  title={What is a Codebook?},
  note={\url{https://www.icpsr.umich.edu/icpsrweb/content/shared/ICPSR/faqs/what-is-a-codebook.html}},
  journal={ICPSR Find & Analyze Data},
  author={ICPSR},
  year={2019},
  month={March},
  day={30}
  }

and then cite the author with \cite{codebook}. This works just fine in my documents.

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.