Fügen Sie nach einem Array in displaymath eine Überschrift hinzu

Fügen Sie nach einem Array in displaymath eine Überschrift hinzu

Ich schreibe Wahrheitstabellen wie diese:

\begin{displaymath}
\begin{array}{|c c|c|}
p & q & p \land q \\
\hline
1 & 1 & 1 \\
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 0 \\
\end{array}
\end{displaymath}

und ich möchte nach der Tabelle eine Überschrift einfügen, die erklärt, was die Tabelle ist. Ich habe beides mit \captionund versucht captionof, aber es wird nicht kompiliert.

Antwort1

Ist das was du willst?

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools,amssymb}
\usepackage{caption}

\begin{document}

\bgroup\setlength{\belowdisplayskip}{-2ex}
\begin{gather*}
\begin{array}{|cc|c|}
p & q & p \land q \\
\hline
1 & 1 & 1 \\
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 0 \\
\end{array}
\shortintertext{%
\captionof{table}{This is my table with caption}}
\end{gather*}
\egroup
Some text. Some more text. Some more text. Some more text. Some more text.

\end{document} 

Bildbeschreibung hier eingeben

verwandte Informationen