我想知道如何\Title
在以下 MWE 中垂直居中框架内的参数。
\documentclass[12pt]{report}
\usepackage[english]{babel}
\usepackage{tikz}
\usepackage[framemethod=TikZ]{mdframed}
\mdfdefinestyle{MyFrame}{%
outerlinewidth=0pt,
roundcorner=10pt,
innerbottommargin=0.5\baselineskip,
innertopmargin=0.5\baselineskip,
font=\Huge,
backgroundcolor=blue}
\newcommand{\Title}[1]{
\begin{mdframed}[style=MyFrame, frametitle={\color{white}#1}, frametitlealignment=\center]
\end{mdframed}
}
\begin{document}
\Title{Title of the text}
\end{document}
答案1
您可以使用设置frametitleaboveskip
从框架标题顶部规则垂直跳过的选项来伪造它。
%http://tex.stackexchange.com/questions/89775/vertically-centre-the-title-in-mdframed
\documentclass[12pt]{report}
\usepackage[english]{babel}
\usepackage{tikz}
\usepackage[framemethod=TikZ]{mdframed}
\mdfdefinestyle{MyFrame}{%
outerlinewidth=0pt,
roundcorner=10pt,
innerbottommargin=0.5\baselineskip,
innertopmargin=0.5\baselineskip,
font=\Huge,
backgroundcolor=blue,
splittopskip=0.5\baselineskip,
frametitleaboveskip=\baselineskip% \baselineskip distance from top rule
}
\newcommand{\Title}[1]{
\begin{mdframed}[style=MyFrame, frametitle={\color{white}#1},frametitlealignment=\center,]
\end{mdframed}
}
\begin{document}
\Title{Title of the text}
\end{document}