![如何在表格内包装公式以减小列宽并增加行粗](https://linux22.com/image/397438/%E5%A6%82%E4%BD%95%E5%9C%A8%E8%A1%A8%E6%A0%BC%E5%86%85%E5%8C%85%E8%A3%85%E5%85%AC%E5%BC%8F%E4%BB%A5%E5%87%8F%E5%B0%8F%E5%88%97%E5%AE%BD%E5%B9%B6%E5%A2%9E%E5%8A%A0%E8%A1%8C%E7%B2%97.png)
我有一张表格,其中最后一列有一个较宽的公式。您知道如何在表格内包装公式以减小列宽并增加行宽吗:
\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}
$