displaymath 내부 배열 뒤에 캡션 추가

displaymath 내부 배열 뒤에 캡션 추가

나는 다음과 같은 진리표를 작성하고 있습니다.

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

그리고 표 뒤에 표가 무엇인지 설명하는 캡션을 넣고 싶습니다. 와 를 모두 사용해 보았 \caption으나 captionof컴파일되지 않습니다.

답변1

이것이 당신이 원하는 것입니까?

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

여기에 이미지 설명을 입력하세요

관련 정보