# Description list Formatting using enumitem

I have a few lines of text that I want to be aligned to look like this:

Here is the MWE:

\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{description}[labelindent=1em ,labelwidth=1.2cm, labelsep*=1em, leftmargin =!, itemindent= 0pt, style = sameline]
\item[Input:] $a_1,\ldots,a_m$
\item[Output:] Can we do some operation on the given input to get some outcome using this  methodology and using $a_1,\ldots,a_m$?
\end{description}
\end{document}


which provides me the output:

As alternatives, I have also tried using \hspace, tried eqnarray to no avail.

• I have been going through enumitem manual and dont you think its possible to set a specific width for the item label so that the item text doesnt come under it? – GermanShepherd Apr 3 at 5:34

You can use for example leftmargin =3cm, to get what you want.

See the complete code

\documentclass{article}

\usepackage{enumitem}

\begin{document}
\begin{description}[%
labelindent=1em,
labelwidth=1.2cm,
labelsep*=1em,
leftmargin =3cm, % <==================================================
itemindent= 0pt,
style = sameline
]
\item[Input:] $a_1,\ldots,a_m$
\item[Output:] Can we do some operation on the given input to get some outcome using this  methodology and using $a_1,\ldots,a_m$?
\end{description}
\end{document}


and the result:

To get the minimal shift to right you can use the following code (use the longest word Output: to get the needed length):

\begin{description}[%
widest=Output:, % <===================================================
itemindent=*,
leftmargin=* % <======================================================
]
\item[Input:] $a_1,\ldots,a_m$
\item[Output:] Can we do some operation on the given input to get some outcome using this  methodology and using $a_1,\ldots,a_m$?
\end{description}


So the following complete code

\documentclass{article}

\usepackage{enumitem}

\begin{document}
\begin{description}[%
labelindent=1em,
labelwidth=1.2cm,
labelsep*=1em,
leftmargin =3cm, % <==================================================
itemindent= 0pt,
style = sameline
]
\item[Input:] $a_1,\ldots,a_m$
\item[Output:] Can we do some operation on the given input to get some outcome using this  methodology and using $a_1,\ldots,a_m$?
\end{description}

\begin{description}[%
widest=Output:, % <===================================================
itemindent=*,
leftmargin=* % <======================================================
]
\item[Input:] $a_1,\ldots,a_m$
\item[Output:] Can we do some operation on the given input to get some outcome using this  methodology and using $a_1,\ldots,a_m$?
\end{description}
\end{document}


shows both solutions and there difference: