我创建了一个新命令,将标题和一些段落格式化为表格样式布局(我称之为音箱)。
boombox 命令是:
\belowcaptionskip=-10pt
\setlength\arrayrulewidth{1pt}
\renewcommand\arraystretch{1.5}
\newcolumntype{I}{!{\vrule width 3pt}}
\newcommand\boombox[2]{
\begin{table}[H]
\begin{tabular}{|Ip{5.67in}I|}
\hhline{|t:=:t|}
{#1} \\ \hhline{|:=:|}
{#2} \\ \hhline{|b:=:b|}
\end{tabular}
\end{table}}
然后我在文档中指出这一点:
\boombox{This is the title of the table}
{This houses the 4 paragraphs I'm writing with \\ in between each one}
我遇到了这篇文章标题中提到的两个错误,但我不知道为什么。这是否与代码中的段落跨越多行有关?
任何帮助将不胜感激!
答案1
你不需要任何table
环境。
错误在于支撑#1
和#2
:
\documentclass{article}
\usepackage{array,hhline}
\newcolumntype{I}{!{\vrule width 3pt}}
\renewcommand\arraystretch{1.5}
\newcommand\boombox[2]{%
\par\noindent
\begin{tabular}{|Ip{5.67in}I|}
\hhline{|t:=:t|}
#1 \tabularnewline \hhline{|:=:|}
#2 \tabularnewline \hhline{|b:=:b|}
\end{tabular}%
}
\begin{document}
\boombox{This is the title of the table}
{This houses the 4 paragraphs I'm writing with \\ in between each one}
\end{document}