1

I would like to automatically center the text in a mdframed environment. The following does not work

\documentclass[a4paper]{article}
\usepackage[tikz]{mdframed}

\newmdenv
[innerleftmargin = 4mm,
innerrightmargin = 4mm,
innertopmargin = 4mm,
innerbottommargin = 4mm,
middlelinewidth = 0.3mm,
linecolor = darkgray,
font=\itshape,
align=center,
roundcorner = 0.5cm]
{important}

\begin{document}
\begin{important}
Test
\end{important}
\end{document}

1 Answer 1

2

Here it is:

\documentclass[a4paper]{article}
\usepackage[tikz]{mdframed}
\usepackage[showframe]{geometry}
\usepackage{etoolbox}
\newmdenv
[innerleftmargin = 4mm,
innerrightmargin = 4mm,
innertopmargin = 4mm,
innerbottommargin = 4mm,
middlelinewidth = 0.3mm,
linecolor = darkgray,
font=\itshape,
align=center,
roundcorner = 0.5cm]
{important}
\newenvironment{Important}{\important\centering}{\endimportant}

\begin{document}

\begin{Important}
Test
\end{Important}

\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .