Como misturar pacotes de titulação e mdframed

Como misturar pacotes de titulação e mdframed

Através de uma dica deste site, usei a embalagem mdframedpara conseguir uma linda caixa arredondada. Mas eu gostaria de incluí-lo no titlingpacote.

O exemplo mínimo a seguir mostra mdframedo funcionamento correto posteriormente no documento. Ele também mostra titlingo funcionamento, como \thedatee \thetitleestão disponíveis depois \maketitle, que é um de seus recursos úteis. E incluí o flushrightambiente que funciona com titling. Mas o mdframedambiente causa erros.

\documentclass{scrartcl}

\usepackage{lipsum}
\usepackage{titling}
\usepackage[framemethod=TikZ]{mdframed}

\title{My document's title}
\author{Jonathan Clark}
\date{10 May 2014}

% \pretitle{\begin{mdframed}[roundcorner=10pt]\LARGE\bfseries}  % doesn't work
\pretitle{\LARGE\bfseries}    % but without mdframed it works
\posttitle{}
\preauthor{\begin{flushright}\scshape}
\postauthor{\end{flushright}}
\predate{\large}
% \postdate{\end{mdframed}}   % doesn't work
\postdate{\end{mdframed}}     % but without mdframed it worsk

\begin{document}
\maketitle
\begin{mdframed}[roundcorner=10pt]
Date: \thedate. Title: \thetitle.
\end{mdframed}

\lipsum{1}

\end{document}

Acredito que estou executando a versão mais recente de todos os pacotes via TeX Live no OS X.

Responder1

Suponho que seja algo como o seguinte que você deseja. Usei o etoolboxpacote e, mais especificamente, \pretocmde \apptocmdme envolvi \maketitleno mdframedambiente:

\documentclass[x11names]{scrartcl}

\usepackage{lipsum}
\usepackage{titling}
\usepackage{fourier}
\usepackage{heuristica}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{etoolbox}
\title{My document's title}
\author{Jonathan Clark}
\date{10 May 2014}

\pretitle{\LARGE\bfseries}
\posttitle{}
\preauthor{\begin{flushright}\scshape}
\postauthor{\end{flushright}}
\predate{\large}
\postdate{}
\pretocmd{\maketitle}{\mdfsetup{roundcorner = 10pt,linewidth = 2pt, linecolor = Red3}\begin{mdframed}}{}{}
\apptocmd{\maketitle}{\end{mdframed}\bigskip}{}{}

\begin{document}
\maketitle

\lipsum{1}

\end{document} 

insira a descrição da imagem aqui

informação relacionada