[Tex/LaTex] How to typeset a quotation in LaTeX that looks like one on TeX.SX

quoting

How do I make this table?

In stackexchange, if you type ">" at the first of the sentence, you get the above quotation.

I tried to do the same thing on LaTeX, but it did not work.

How do I make that?

Best Answer

\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}

output1_quote

Addendum

If the background should be colored you can use the tcolorbox package:

\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
}

output2

The final version could then be:

\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}

output3

output_final