Enclosing list in a box
With standard frame, you need only add leftmargin=*
option to enumerate
list:
\documentclass{article}
\usepackage{enumitem}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
\begin{document}
\noindent\fbox{%
\parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax}{
\begin{enumerate}[label=Step \Roman*, leftmargin=*]
\item item 1
\item item 2
\item item 3
\item item 4
\item item 5
\item item 6
\end{enumerate}
}%
}
\end{document}
(red lines indicate page layout)
If you want to put frames etc round your list environment then I suggest using tcolorbox as this will give you much more control. For example, you can produce
using the code:
\documentclass{article}
\usepackage{enumitem}
\usepackage{tcolorbox}
\newlist{steps}{enumerate}{1}% create new steps environment
\setlist[steps]{% configure the steps environment
label=Step \Roman*,
leftmargin=*,
align=left
}
\tcbuselibrary{skins}
\tcolorboxenvironment{steps}{% wrap the steps environment in a tcolorbox
colframe=red!75!black
}
\begin{document}
\begin{steps}
\item item 1
\item item 2
\item item 3
\item item 4
\item item 5
\item item 6
\end{steps}
\end{document}
A few comments about the code:
- The MWE example appears to be using the enumitem package so, as above, I recommending using
\newlist
to define a customsteps
environment and then\setlist
to configure this enivorment. - The
\tcolorboxenvironment{steps}{...}
command wraps thesteps
environment inside a very simpletcolorbox
, which is highly customisable. I recommend reading the tcolorbox manual, after which you can configure this to your heart's content.