LaTeX forum ⇒ Text Formattingverbatim inside savebox, newwatermark... Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
erwann
Posts: 64
Joined: Thu Aug 25, 2016 2:24 am

verbatim inside savebox, newwatermark...  Topic is solved

Postby erwann » Thu May 24, 2018 7:55 pm

Hello, how do I get verbatim to work inside savebox, newwatermark?

  1. \newwatermark*[allpages,color=red!50,angle=45,scale=2,xpos=0,ypos=0]
  2. {
  3. % What I would like, but generates error
  4. % \verb|Copyright (2018) <!-- e --><a href="mailto:name@gmail.com">name@gmail.com</a><!-- e -->|
  5. % Poor workaround:
  6. $\mathrm{Copyright (2018) <!-- e --><a href="mailto:name@gmail.com">name@gmail.com</a><!-- e -->}$
  7. }
x_86 / Linux Mint 18.3 / texlive 2015.20160320-1ubuntu0.1 / TeXworks 0.5r1361 (Debian)

Tags:

kaiserkarl13
Posts: 593
Joined: Tue Mar 25, 2008 5:02 pm

Postby kaiserkarl13 » Fri May 25, 2018 8:09 am

You don't. The \verb command and the verbatim environment must be able to be rendered immediately; they cannot appear in footnotes, headers, section headings, captions, and so forth.

If you want fixed-width fonts in such contexts, use the \texttt command. By the way, next time give a minimum working example so we don't have to spend ten minutes trying to figure out which package provides the newwatermark command.

I made the following minimal working example of something that actually generates a document:
  1. \documentclass{article}
  2. \usepackage{textcomp}
  3. \usepackage{xcolor}
  4. \usepackage{xwatermark}
  5. \newwatermark*[allpages,color=red!50,angle=45,scale=2,xpos=0,ypos=0]
  6. {% Better?
  7. Copyright \copyright 2018 \href{mailto:name@gmail.com}{\texttt{name@gmail.com}}
  8. }
  9. \begin{document}
  10. hello
  11. \end{document}

You're going to want to adjust the parameters, because scale=2 is too big.

erwann
Posts: 64
Joined: Thu Aug 25, 2016 2:24 am

Postby erwann » Sun May 27, 2018 12:39 am

By the way, next time give a minimum working example so we don't have to spend ten minutes trying to figure out which package provides the newwatermark command.


Sorry. I thought someone would know off the top of his head, I would have been happy with just try "texttt".
x_86 / Linux Mint 18.3 / texlive 2015.20160320-1ubuntu0.1 / TeXworks 0.5r1361 (Debian)


Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 4 guests