我的 MWE,
\documentclass[a4paper,11pt]{book}
\usepackage{tabularx}
\usepackage{tikz}
\begin{document}
\begin{enumerate}
\newcommand{\OOO}[4]{%
\begin{tabularx}{\linewidth}{@{}X@{}l@{}}
\textbf{A)} #1 & \textbf{B)} #2 \\
\textbf{C)} #3 & \textbf{D)} #4 \\
\end{tabularx}}
{\item Convert the current source into an equivalent voltage source\\
\OOO{\input{./ABC/SZ-1a.tex}}
{\input{./ABC/SZ-1b.tex}}
{\input{./ABC/SZ-1c.tex}}
{\input{./ABC/SZ-1d.tex}}}
\end{enumerate}
\end{document}
并显示
还
{\item Convert the current source into an equivalent voltage source...\\
\begin{tabular}{ll}
\textbf{A)} & \textbf{B)}\\
\input{./ABC/SZ-1a.tex}&\input{./ABC/SZ-1a.tex}\\
\multicolumn{2}{l}{} \\
\textbf{C)} & \textbf{D)}\\
\input{./ABC/SZ-1c.tex}&\input{./ABC/SZ-1d.tex}
\end{tabular}}
并显示
怎么降档了?有解决办法吗?
答案1
tabularx
如果我理解正确的话,对于或解决方案没有特殊要求tabular
。
宏\OOO
可以通过四个小页面来制作。我提供了另一种方法,使用tcolorbox
及其raster
库来设置这四个部分:
\documentclass[a4paper,11pt]{book}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage[skins,raster]{tcolorbox}
\begin{document}
\begin{enumerate}
\newcommand{\OOO}[4]{%
\begin{tcbitemize}[blanker,fonttitle=\bfseries,coltitle=black,
raster valign=top,raster row skip=2mm,raster column skip=4mm]
\tcbitem[title=A)] #1
\tcbitem[title=B)] #2
\tcbitem[title=C)] #3
\tcbitem[title=D)] #4
\end{tcbitemize}}
\item Convert the current source into an equivalent voltage source
\OOO{\includegraphics[width=\linewidth]{example-image-a}}
{\small\lipsum[2]}
{\small\lipsum[3]}
{\includegraphics[width=\linewidth]{example-image-b}}
\end{enumerate}
\end{document}
上述代码可生成顶部对齐的部分或单元格。以下变体可生成居中对齐的单元格:
\documentclass[a4paper,11pt]{book}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage[skins,raster]{tcolorbox}
\begin{document}
\begin{enumerate}
\newcommand{\OOO}[4]{%
\begin{tcbitemize}[blanker,fonttitle=\bfseries,coltitle=black,valign=center,
raster equal height=rows,
raster row skip=2mm,raster column skip=4mm]
\tcbitem[title=A)] #1
\tcbitem[title=B)] #2
\tcbitem[title=C)] #3
\tcbitem[title=D)] #4
\end{tcbitemize}}
\item Convert the current source into an equivalent voltage source
\OOO{\includegraphics[width=\linewidth]{example-image-a}}
{\small\lipsum[2]}
{\small\lipsum[3]}
{\includegraphics[width=\linewidth]{example-image-b}}
\end{enumerate}
\end{document}
最后,还有另一种变体,它构成了四个部分:
\documentclass[a4paper,11pt]{book}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage[skins,raster]{tcolorbox}
\begin{document}
\begin{enumerate}
\newcommand{\OOO}[4]{%
\begin{tcbitemize}[enhanced,size=small,sharp corners,colback=white,
colframe=black!20,colbacktitle=blue!10,
fonttitle=\bfseries,coltitle=black,valign=center,
raster equal height=rows,raster row skip=1mm,raster column skip=1mm]
\tcbitem[title=A)] #1
\tcbitem[title=B)] #2
\tcbitem[title=C)] #3
\tcbitem[title=D)] #4
\end{tcbitemize}}
\item Convert the current source into an equivalent voltage source
\OOO{\includegraphics[width=\linewidth]{example-image-a}}
{\small\lipsum[2]}
{\small\lipsum[3]}
{\includegraphics[width=\linewidth]{example-image-b}}
\end{enumerate}
\end{document}