8

I want my itemize environment to output something like

Email:     my@email.com

Address:   Street name
           City
           Country

Phone:     My phone number

I have tried using \usepackage{enumitem} and \setitemize{leftmargin=*, align=left} but the output is just

Email: my@email.com

Address: Street name
  City
  Country

Phone: My phone number

I could probably accomplish what I want with a table, but shouldn't it be possible to do the same with itemize?

0

5 Answers 5

8

Another solution :

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[align=parleft, labelsep=2cm,]
\item[test1:] premier item;
\item[Coucou:] deuxième item;\\
  line 2
\item[test\_auto:] troisième item.
\end{enumerate}
\end{document}

enter image description here

2
  • Thanks! Can I do something to make sure the labels are aligned with the margin of the page? Right now the labels are more left than the rest of the text on my page. If I use leftmargin=*, the labelwidth is ignored... I use \setitemize{leftmargin=*, align=parleft, labelsep=2cm} but some labels are too wide
    – Jamgreen
    Nov 14, 2015 at 9:46
  • You can use : \leftskip=
    – flav
    Nov 14, 2015 at 10:11
9

You can simply modify some parameters of a description environment:

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{description}[labelwidth=4em,leftmargin =\dimexpr\labelwidth+\labelsep\relax, font=\sffamily\mdseries]
\item[Email:] my@email.com

\item[Address:] Street name\\
                    City\\
                    Country

\item[Phone:] My phone number
\end{description}

\end{document} 

enter image description here

3

You may want to use tabbing:

\documentclass{article}

\begin{document}

\begin{tabbing}
Address: \=\kill
Email:   \> my@email.com \\[1ex]
Address: \> Street name \\
         \> City \\
         \> Country \\[1ex]
Phone:   \> My phone number
\end{tabbing}

\end{document}

enter image description here

If you have to compile a directory, use \\* instead of \\ so no page break can happen inside an entry.

It wouldn't also be difficult providing an interface such as

\personaldata{
  email   = my@email.com,
  address = Street name \\ City \\ Country,
  phone   = +55 555 555 5555,
}
1

Design own list! From "The LaTeX Companion":

\documentclass{article}
    \usepackage{calc}
    \usepackage{hyperref}

\newcommand{\entrylabel}[1]{%
     \makebox[\labelwidth][l]{\parbox[t]{\labelwidth}{\raggedleft#1}}%
                             }% end of definition

\newenvironment{entry}[1]%
    {\begin{list}{}{%
        \renewcommand{\makelabel}{\entrylabel}%
        \settowidth{\labelwidth}{#1:~}%
        \setlength{\leftmargin}{\labelwidth + \labelsep}
        \setlength{\listparindent}{2ex}%
        \setlength{\parsep}{0.2\baselineskip}
        \setlength{\itemsep}{0.2\baselineskip}
    }}%
    {\end{list}}

\begin{document}
    \begin{entry}{Address:}
\item[e-mail:]      \href{mailto:my@email.com}{my@email.com}
\item[Address:]     Street name\\
                    City\\
                    Country
\item[Phone:]       My phone number
    \end{entry}
\end{document}

enter image description here

Of course, similar result you can obtain with enumitem. In this case you need define adequate labelwidth.

0

for this use can just use \item[•]

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}[leftmargin=*]
\item[Email:]       my@email.com

\item[Address:]     Street name\\
                    City\\
                    Country

\item[Phone:]       My phone number
\end{enumerate}

\end{document}
2
  • 1
    labels not left aligned.
    – touhami
    Nov 14, 2015 at 8:14
  • No, may be you don't understand the question (or may be that's me)
    – touhami
    Nov 14, 2015 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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