How could I create a new environment to automated the following code?
\noindent\fcolorbox{white}{lightgray}{ \begin{minipage}{0.96\textwidth}
some text in here
\end{minipage} }
How could I create a new environment to automated the following code?
\noindent\fcolorbox{white}{lightgray}{ \begin{minipage}{0.96\textwidth}
some text in here
\end{minipage} }
Maybe a simple new command can also do the job:
\documentclass{article}
\usepackage{xcolor}
\newcommand{\foo}[1]{%
\noindent%
\fcolorbox{white}{lightgray}{%
\begin{minipage}{0.96\textwidth}
#1
\end{minipage}%
}%
}
\begin{document}
\foo{some text}
\end{document}
Needless to reinvent the wheel: you already have the shaded(*)} environment from the framed package. . Furthermore, these environments can break across pages. The shaded* environment makes the shaded area fit exactly the margin, whereas shaded makes the text justified between the margins and the shaded area overflows the margin:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[showframe]{geometry}
\usepackage{lipsum}
\usepackage[svgnames]{xcolor}
\usepackage{framed}
\colorlet{shadecolor}{Gainsboro!60!Lavender}
\begin{document}
\noindent\fcolorbox{white}{lightgray}{ \begin{minipage}{0.96\textwidth}
some text in here
\end{minipage}}
\begin{shaded}
\lipsum[1-3]
\end{shaded}
\begin{shaded*}
\lipsum[4-7]
\end{shaded*}
\end{document}
\colorbox? – samcarter_is_at_topanswers.xyz Apr 23 '18 at 17:03