5

I am using some big faculty LaTeX template for my thesis, so I do not really know, which packages I am supposed to mention here ...

Anyway, I am trying to write some urls.

I write them like

\url{http://tex.stackexchange.com/questions/ask}

But the result in the PDF is

¡http://tex.stackexchange.com/questions/ask¿

What can be wrong? How can I get rid of those marks?

1
  • 2
    Welcome to TeX.SX. For errors like these it is best to add a minimal working example (MWE) that illustrates them. This way people can compile it by themselves and also test their solutions. Commented May 8, 2011 at 20:07

2 Answers 2

5

Does your template redefine \url such that its output should look like <https://tex.stackexchange.com/questions/ask> (including the angular brackets)? In this case the font encoding might be wrong. Try adding \usepackage[T1]{fontenc} to the preamble (or use \textless and \textgreater in the definition of \url).

See also Why do the less than symbol (<) and the greater than symbol (>) appear wrong as upside down exclamation (¡) or question mark (¿)?.

2
  • thank you, \usepackage[T1]{fontenc} remove !? but it replaces them with <,> ... is there any way to have only url? or is it typographically wrong?
    – relaxxx
    Commented May 9, 2011 at 7:04
  • 1
    @relaxxx: As a default \url doesn't add anything around the text. So something in your document changed the default behaviour - perhaps by redefining the \UrlLeft and \UrlRight commands mentioned by egreg. That's the problem when using "big" templates. They can do a lot of unusual things. Commented May 9, 2011 at 8:28
7

You are probably writing <\url{http://tex.stackexchange.com/questions/ask}>; the standard setup for LaTeX fonts has ¡ and ¿ in place of < and >. In order to get typewriter < and > use \texttt{<} and \texttt{>}. Those characters in the normal font would be wrong anyway.

The documentation of the url package shows a trick for having those characters automatically: put

\DeclareUrlCommand\url{\def\UrlLeft{<}\def\UrlRight{>}\urlstyle{tt}}

in the preamble of your document.

1
  • I am not writing <...> i have just text \url{} text, but when I try copy !url? from my pdf, it copy it in <url> format
    – relaxxx
    Commented May 9, 2011 at 7:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .