我有一张表格,其中最后一列有一个较宽的公式。您知道如何在表格内包装公式以减小列宽并增加行宽吗:
\documentclass[openany]{book}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{changepage}
\usepackage{geometry}
\geometry{paperheight=9.8125in,paperwidth=8in, left=.5in,
right=.5in,top=.75in,bottom=.4375in }
\renewcommand{\rmdefault}{pag}
\usepackage{mdframed}
\mdfdefinestyle{exampledefault}{linewidth=2pt}
\usepackage{amsthm}
\newtheorem{my_example}{EXAMPLE}[chapter]
\begin{document}
\begin{adjustwidth}{2.25in}{0pt}
\chapter{first chapter}
\section{first section}
This is my first table:
\begin{table}[h!]
\begin{adjustwidth}{2.25in}{0pt}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline $x$ & $y$ & $z$ & $x \circ y$ & $x \circ z$ & $\left(x \circ
y\right)\oplus\left(x \circ z\right)$ & $\left[\left(z \circ
x\right)\oplus\left(x \circ z\right)\right] \circ \left(z \circ x\right)$\\
\hline $a$&$b$ &$c$ &$d$ &$e$&$f$&$g$\\
\hline
\end{tabular}
{\caption{my first table}} \label{table_first}
\end{center}
\end{adjustwidth}
\end{table}
\end{adjustwidth}
\end{document}
答案1
您可以使用aligned
环境将任何公式拆分为多行。我还使用了 anarray
而不是 a,tabular
因为您只有数学。
\documentclass[openany]{book}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{changepage}
\usepackage{geometry}
\geometry{paperheight=9.8125in,paperwidth=8in, left=.5in,
right=.5in,top=.75in,bottom=.4375in }
\renewcommand{\rmdefault}{pag}
\usepackage{mdframed}
\mdfdefinestyle{exampledefault}{linewidth=2pt}
\usepackage{amsthm}
\newtheorem{my_example}{EXAMPLE}[chapter]
\begin{document}
\begin{adjustwidth}{2.25in}{0pt}
\chapter{first chapter}
\section{first section}
This is my first table:
\begin{table}[h!]
\begin{adjustwidth}{2.25in}{0pt}
\begin{center}
$
\begin{array}{|*7{c|}}
\hline x & y & z & x \circ y & x \circ z & (x \circ y)\oplus(x \circ z) & \begin{aligned} & [(z\circ x) \oplus (x\circ z)] \\ & \qquad\circ (z\circ x)\end{aligned} \\
\hline a & b & c & d & e & f & g\\
\hline
\end{array}
$
{\caption{my first table}} \label{table_first}
\end{center}
\end{adjustwidth}
\end{table}
\end{adjustwidth}
\end{document}
编辑:更好的是,正如@Mico所建议的,您可以使用包(supersedes )gathered
中的环境,代码将进一步简化:mathtools
amsmath
$
\begin{array}{|*7{c|}}
\hline x & y & z & x \circ y & x \circ z & (x \circ y)\oplus(x \circ z) & \begin{gathered} [(z\circ x) \oplus (x\circ z)] \\ \circ (z\circ x)\end{gathered} \\
\hline a & b & c & d & e & f & g\\
\hline
\end{array}
$