Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to type brace symbol inside a URL using the url or hyperref package. Is there a way to do that ?

(the idea is to typeset REST-like URL, as for example,

http://foo.bar/orders{orderID}
share|improve this question

2 Answers 2

up vote 12 down vote accepted

Just type the URL:

\documentclass{article}
\usepackage{url}
\begin{document}
\url{http://foo.bar/orders{orderID}}
\end{document}

enter image description here

With hyperref it's the same, but the result is an invalid URL, I guess.

share|improve this answer
    
hum ... I am confused .. I spent one hour trying to solve a non-existent problem. Thanks egreg. –  jean Feb 25 at 10:06
    
@jean In general, though, adding a backslash before the brace will escape it and allow you to display a curly brace on screen, e.g., \{Hello\}. –  Dennis Feb 25 at 18:08

With hyperref, for fun (egreg was tooooo fast with url ;)...)

\documentclass{article}
\usepackage{hyperref}
\begin{document}
  \href{http://foo.bar/orders{orderID}}{\texttt{http://foo.bar/orders\{orderID\}}}
\end{document}

enter image description here

share|improve this answer
    
Or \url{http://foo.bar/orders{orderID}}, no need for \href here. –  Heiko Oberdiek Feb 25 at 13:45
    
@HeikoOberdiek: Correct, but you know egreg was faster than me in typing. Hence I thought of alternative. :) –  Harish Kumar Feb 25 at 13:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.