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.
[Tex/LaTex] Url with fragments in bold
boldtext-decorationsurls
Best Answer
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 theurl
package. Note that\url
is defined by theurl
package which is loaded byhyperref
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.
Result: