如何在 tabularx 环境中使用列表多列?

如何在 tabularx 环境中使用列表多列?

我想在 tabular 环境中插入 multicol。下面是平均能量损失

\documentclass[a4paper, 11pt]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{multicol}


\begin{document}




\begin{tabularx}{\textwidth}{|c|X|c|}\hline 
\textbf{Q. No.} &  & \textbf{marks}\\ \hline 
  26. &  A polynomial of odd degree with real coefficients must have \begin{enumerate}
      \item at least one real root.
      \item no real root.
      \item only real root.
      \item at least one root which is not real.
  \end{enumerate} & 4\\ 

    26. &  Let $A,B$ be $n\times n$ matrices. Which of the following equals $\operatorname{trace}(A^2B^2)$ \begin{enumerate}
 \item 
      $(\operatorname{trace}(AB))^2$
\item $\operatorname{trace}(AB^2A)$
\item $\operatorname{trace}((AB)^2)$
\item $\operatorname{trace}(BABA)$
  \end{enumerate} & 4\\ \hline 
\end{tabularx}

\end{document}

得出:

在此处输入图片描述

但我想要的是这个:
在此处输入图片描述

当我使用时:

26.   Let $A,B$ be $n\times n$ matrices. Which of the following equals $\operatorname{trace}(A^2B^2)$
\begin{multicols}{2}
    \begin{enumerate}
        \item $(\operatorname{trace}(AB))^2$
        \item $\operatorname{trace}(AB^2A)$
        \item $\operatorname{trace}((AB)^2)$
        \item $\operatorname{trace}(BABA)$
    \end{enumerate}     

\end{multicols} 

这会产生错误。我该如何解决此问题

答案1

我在使用时没有遇到任何问题multicols。但我建议您加载enumitem包来修改环境的外观enumerate

在此处输入图片描述

\documentclass[a4paper, 11pt]{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}

\usepackage{amsmath}
\DeclareMathOperator{\trace}{trace}

\usepackage{array}
\setlength\extrarowheight{2pt}

\usepackage{tabularx,multicol}

\usepackage{enumitem}
\setlist[enumerate]{nosep,wide,leftmargin=*}

\begin{document}

\noindent
\begin{tabularx}{\textwidth}{|c|X|c|}
\hline 
\textbf{No.} & \textbf{Question} & \textbf{marks}\\ \hline 
26. &  
A polynomial of odd degree with real coefficients must have 
\begin{multicols}{2}
\begin{enumerate}
      \item at least one real root.
      \item no real root.
      \item only real roots.
      \item at least one root which is not real.
\end{enumerate} 
\end{multicols}
& 4\\ 

27. &  
Let $A,B$ be $n\times n$ matrices. Which of the following equals $\trace(A^2B^2)$ 
\begin{multicols}{2}
\begin{enumerate}
\item $(\trace(AB))^2$
\item $\trace(AB^2A)$
\item $\trace((AB)^2)$
\item $\trace(BABA)$
\end{enumerate} 
\end{multicols}
& 4\\ 
\hline 
\end{tabularx}

\end{document}

相关内容