Text FormattingHash in a URL

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ac10
Posts: 13
Joined: Wed Dec 29, 2010 3:01 pm

Hash in a URL

Post by ac10 »

Hello everyone,

I'm trying to use a hash symbol as part of a url. I want the url to be clickable so \# doesn't work. It cuts everything after it out of the url.

I tried putting it in math mode, but that didn't work either.

I get this error - You can't use `macro parameter character #' in horizontal mode.

This is my header....

Code: Select all

\documentclass{book}
\pagestyle{empty}
\usepackage[margin=1in]{geometry}                  
\geometry{a4paper,margin=1in,} 
\usepackage{url}   
Thanks very much for your help.
Last edited by ac10 on Sat Dec 17, 2011 4:59 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10397
Joined: Mon Mar 10, 2008 9:44 pm

Hash in a URL

Post by Stefan Kottwitz »

To get a clickable URL, you should load the hyperref package in addition:

Code: Select all

\usepackage{hyperref}
Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Hash in a URL

Post by localghost »

An adequate problem description would contain a minimal example.

Code: Select all

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage{hyperref}

\begin{document}
  \url{http://mirror.ctan.org/info/latex2e-help-texinfo/latex2e.html#toc-Overview-of-LaTeX-1}
\end{document}

Thorsten
Post Reply