TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to write document containing a lot of URLs but some fragments of these URLs have to be in bold. How can I accomplished this? For urls I use \nolinkurl but I can't use \bf in it.

share|improve this question
up vote 15 down vote accepted

You can select the font used for URL using \urlstyle. However bold font isn't supported out-of-the-box. You need to patch the required style definitions as shown below. You need to use a font which supports a bold+text-typer style (expect you want to have the URLs in normal Roman style).

You need to mark the parts of the URL which is different with a different macro. You can define these macros using \DefineUrlCommand from the url package. Note that \url is defined by the url package which is loaded by hyperref which then redefines this macro to an hyperlinked version and provides \nolinkurl as replacement.

Update: I added underline style as now requested. This can be done with the help of the ulem package. I also added other fancy URL styles.

Update 2: Simplified code. Added color example.


%% works with `url` only as well:

% Use a font which gives you bold text-typer:


% Colors:

% More fancy URL styles:

    \expandafter{\csname fancyurl@\expandafter\@gobble\string#2\endcsname}{#1}{#2}%
    \let#1\empty % must not be \relax







share|improve this answer
And how can I get underlined parts? Parts in bold are hard to notice when font size is small. – jesper Mar 3 '11 at 18:16
@jesper: Here you go. For completeness I added other styles as well :-) – Martin Scharrer Mar 3 '11 at 19:07

Your Answer


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.