我想在“文本 1”和“这是标题”之间添加一个换行符(见图)。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{mdframed}
\mdfdefinestyle{textSty}{font=\small,backgroundcolor=green!10, linewidth=0pt, innerleftmargin=3ex, innerrightmargin=3ex, innertopmargin=3ex, innerbottommargin=3ex, innermargin=+0.5cm, outermargin =+0.5cm}
\newcounter{textCounter}
\newmdtheoremenv[style=textSty]{myText}[textCounter]{Text}
\begin{document}
\begin{myText}
\begin{center}
\textsc{This is the title} \\
\textit{This is the author}
\end{center}
This is the text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text.
\end{myText}
\end{document}
答案1
您只需要\hfill
在-environment 的开头添加即可myText
。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{mdframed}
\mdfdefinestyle{textSty}{
font=\small,
backgroundcolor=green!10,
linewidth=0pt,
innerleftmargin=3ex,
innerrightmargin=3ex,
innertopmargin=3ex,
innerbottommargin=3ex,
innermargin=+0.5cm,
outermargin =+0.5cm,
}
\newcounter{textCounter}
\newmdtheoremenv[style=textSty]{myText}[textCounter]{Text}
\begin{document}
\begin{myText}
\hfill % <- NEW
\begin{center}
\textsc{This is the title} \\
\textit{This is the author}
\end{center}
This is the text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text. More text.
\end{myText}
\end{document}