1

I have added a frame around my document title using mdframed. The document compiles and displays properly but keeps throwing the following error:

Something's wrong--perhaps a missing \item. \end

Any ideas about what is happening with this? Here is the syntax being used:

\begin{document}

\begin{mdframed}
\maketitle
\end{mdframed}

%Body text here

\end{document}

mdframed initialized with:

\usepackage[framemethod=default]{mdframed}
\mdfdefinestyle{MyFrame}{%
    linecolor=black,
    outerlinewidth=2pt,
    %roundcorner=20pt,
    innertopmargin=4pt,
    innerbottommargin=4pt,
    innerrightmargin=4pt,
    innerleftmargin=4pt,
    leftmargin = 4pt,
    rightmargin = 4pt
    %backgroundcolor=gray!50!white}
}

Thanks!

  • welcome to tex.sx. i've forgotten whether mdframed treats its arguments as list items, but so many unlikely environments do, so it's worth looking at. – barbara beeton Jan 27 '18 at 19:40
  • 1
    Could you post a compilable code? – Bernard Jan 27 '18 at 19:45
1

There's no problem if you load titling and use the \maketitlehookx commands to enter and leave the mdframed environnment:

\documentclass[11pt, svgnames]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{garamondx}
\usepackage{verse}
\usepackage{titling}
\usepackage[framemethod=tikz]{mdframed}
\mdfdefinestyle{MyFrame}{%
    linecolor=Tomato,
    outerlinewidth=2,
    roundcorner=10pt,
    innertopmargin=15pt,
    innerbottommargin=4pt,
    innerrightmargin=4pt,
    innerleftmargin=4pt,
    leftmargin = 4pt,
    rightmargin = 4pt,
    backgroundcolor=WhiteSmoke
}
 \author{Edward Lear}
 \title{The Quangle Wangle’s Hat}
 \date{(n.\,d.)}

\renewcommand{\maketitlehooka}{\begin{mdframed}[style = MyFrame]}
\renewcommand{\maketitlehookd}{\end{mdframed}\vspace{5ex}}
\begin{document}

\maketitle
\settowidth{\versewidth}{For his Hat was a hundred and two feet wide,}
\begin{verse}[\versewidth]
\begin{altverse}
  On the top of the Crumpetty Tree\\
      The Quangle Wangle sat,\\
But his face you could not see,\\
      On account of his Beaver Hat.\\
For his Hat was a hundred and two feet wide,\\
With ribbons and bibbons on every side\\
And bells, and buttons, and loops, and lace,\\
So that nobody ever could see the face\\
            Of the Quangle Wangle Quee.
\end{altverse}
\end{verse}

\end{document} 

enter image description here

  • Works beautifully! Thank you Bernard! I wasn't familiar with the \maketitlehook command. – CCTech Jan 28 '18 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.