我如何制作这张表?
在 stackexchange 中,如果你在句子开头输入“>”,你就会得到上述引用。
我尝试在 LaTeX 上做同样的事情,但没有成功。
我该如何做呢?
答案1
\documentclass{article}
\makeatletter
\renewenvironment{quote}{%
\vskip 10\p@
\parindent\z@
\d@ublerule
\list{}{\rightmargin\leftmargin}%
\item\relax
}{%
\endlist
\d@ublerule
}
\def\d@ublerule{\hrule\@width\hsize\kern 1.5\p@\hrule\@width\hsize}
\makeatother
\begin{document}
\begin{quote}
How do I make this table?
\end{quote}
\end{document}
附录
如果背景需要彩色,则可以使用以下tcolorbox
包:
\renewenvironment{quote}{%
\vskip 10\p@
\parindent\z@
\tcolorbox[
sharp corners,
boxrule=\z@,
boxsep=\z@,
left=\z@,
right=\z@,
top=\z@,
bottom=\z@
]
\d@ublerule
\vskip 5\p@
\list{}{\rightmargin\leftmargin}%
\item\relax
}{%
\endlist
\d@ublerule
\endtcolorbox
}
最终版本可能是:
\documentclass{article}
\usepackage{xcolor}
\definecolor{sx-yellow}{RGB}{249,245,233}
\definecolor{sx-orange}{RGB}{224,215,188}
\usepackage[most]{tcolorbox}
\makeatletter
\renewenvironment{quote}{%
\vskip 10\p@
\parindent\z@
\tcolorbox[
breakable, sharp corners,
boxrule=\z@, boxsep=\z@,
left=\z@, right=\z@,
top=\z@, bottom=\z@,
colback=sx-yellow
]
{\color{sx-orange}\d@ublerule}
\vskip 5\p@
\list{}{\rightmargin\leftmargin}%
\item\relax
}{%
\endlist
{\color{sx-orange}\d@ublerule}
\endtcolorbox
\vskip 5\p@
}
\def\d@ublerule{\hrule\@width\hsize\kern 1.5\p@\hrule\@width\hsize}
\makeatother
\begin{document}
\begin{quote}
How do I make this table?
\end{quote}
\end{document}
答案2
答案3
另一种可能性是单独使用该包tcolorbox
并使用它定义自定义环境。如果不需要重新定义环境quote
,我认为这个解决方案比@Ruben 的解决方案更容易阅读和调整。除此之外,当框太大时,它会在开头和结尾引入一个小的填充,因此需要分页。看看第二张截图,了解它会是什么样子。
\documentclass{article}
\usepackage[most]{tcolorbox}
\definecolor{background}{HTML}{F9F5E9}
\definecolor{linecolor}{HTML}{E0D7BC}
\newtcolorbox{QuoteBox}{%
breakable,
enhanced,
sharp corners,
colback=background,
colframe=background,
borderline north={0.5pt}{0pt}{linecolor},
borderline north={0.5pt}{1.5pt}{linecolor},
borderline south={0.5pt}{0pt}{linecolor},
borderline south={0.5pt}{1.5pt}{linecolor},
}
\begin{document}
\begin{QuoteBox}
How do I make this table?
\end{QuoteBox}
\end{document}
输出: