如果有人能帮助我修复以下代码的标题,那将会非常有帮助:
\documentclass[a0,portrait]{a0poster}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes,arrows,shadows,petri,decorations.markings}
\definecolor{pms286}{RGB}{4,52,177}
\tikzstyle{mybox} = [draw=pms286!80, fill=blue!20, very thick,
rectangle, rounded corners=30pt, inner sep=10pt, inner ysep=30pt,color=blue!20]
\def\Title#1{\noindent{\VeryHuge\color{pms286} #1}}
%\begin{document}
\newcommand{\displaytitle}[3]{%
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.93\textwidth}
\begin{tabular}{lc}
\multirow {3}{*}{\includegraphics[width=0.125\textwidth]{some logo}}
& \baselineskip=3\baselineskip\Title{#1}\\\\
& \Huge\color{pms286!90}{#2} \\\\
& \LARGE\color{pms286!80}{#3}\\
\end{tabular}
\end{minipage}
};
\end{tikzpicture}
}
\begin{document}
\centering
\displaytitle{A very very very very very very \\very very very very very very very very very very
long title. }{Author}{University}
\end{document}
注意:缺少徽标图像,因此编译会出错。但这不是这里的问题。
我的问题是,使用此 displaytitle 设置,标题只有一行。如果标题真的很长(两行),则不能换行。`\' 换行符会删除格式(如图所示)。
请帮忙。
答案1
您需要定义一个newcolumntype
用于文本换行的数组包。这里定义了两种列类型,需要 #1 宽度参数。P
是用于文本垂直对齐在顶部的段落列,而C
是用于文本垂直对齐在中间的段落列。此外,multirow
还需要一个包,但 OP 中未加载该包。
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
代码
\documentclass[a0,portrait]{a0poster}
\usepackage{array,tikz,multirow}
\usetikzlibrary{shapes,snakes,arrows,shadows,petri,decorations.markings}
\definecolor{pms286}{RGB}{4,52,177}
\tikzstyle{mybox} = [draw=pms286!80, fill=blue!20, very thick,
rectangle, rounded corners=30pt, inner sep=10pt, inner ysep=30pt,color=blue!20]
\def\Title#1{\noindent{\VeryHuge\color{pms286} #1}}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
%\begin{document}
\newcommand{\displaytitle}[3]{%
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.93\textwidth}
\begin{tabular}{l C{0.8\textwidth}}
\multirow {3}{*}{\includegraphics[width=0.125\textwidth]{example-image-a}}
&\baselineskip=3\baselineskip\Title{#1}\\\\
&\Huge\color{pms286!90}{#2} \\\\
&\LARGE\color{pms286!80}{#3}\\
\end{tabular}
\end{minipage}
};
\end{tikzpicture}
}
\begin{document}
\displaytitle{A very very very very very very very very very very very very very very very very long title}
{Author}
{University}
\end{document}