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 align some urls:

\documentclass[12pt,a4paper,oneside]{book}
\usepackage{url}

\begin{document}

 Figure 1:\; \url{my first url}
             \url{my second url}

\end{document}

How can I do?

EDIT: I used:

\documentclass[12pt,a4paper,oneside]{book}
\usepackage{url}

\begin{document}
\noindent
\begin{tabular}{@{}r@{\hspace{.5em}}l}

Figure 1: & \url{firsturl}
%
Figure 10: & \url{tenthurl}

\end{tabular}

\end{document} 

How to align respect the left margin?

share|improve this question
    
How about a tabular? –  mafp Jan 12 '13 at 14:20
    
Are you using \url inside a \caption? –  Sigur Jan 12 '13 at 14:50
1  
@Sigur No, not inside a \caption... –  Ford Prefect Jan 12 '13 at 15:08

1 Answer 1

up vote 4 down vote accepted

You can use tabular or tabbing:

\documentclass[12pt,a4paper,oneside]{book}
\usepackage{url}
%
\begin{document}
\noindent
\begin{tabular}{@{}r@{\hspace{.5em}}l}
  Figure 1: & \url{my first url} \\
            & \url{my second url} 
\end{tabular}

\noindent
\begin{tabbing}
  Figure 1: \= \url{my first url} \\
                     % \> for next tab, \\ for new line...
            \> \url{my second url} 
\end{tabbing}    
%
\end{document}

enter image description here

Edit

This is to address the edited question: To align Figure with respect to the left margin, change the first column type from r to l:

\documentclass[12pt,a4paper,oneside]{book} 
\usepackage{url}
\usepackage{showframe} %% just for showing the left margin as a line
\begin{document}
\noindent
\begin{tabular}{@{}l@{\hspace{.5em}}l}
Figure 1:  & \url{firsturl}\\
%
Figure 10: & \url{tenthurl}
\end{tabular}

\bigskip
\noindent
\begin{tabular}{@{}l@{}c@{\hspace{.5em}}l}
Figure 1  & : & \url{firsturl}\\
%
Figure 10 & : & \url{tenthurl}
\end{tabular}
%
\end{document}

enter image description here

share|improve this answer

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.