如何拆分长表单元格并根据图像宽度调整宽度

如何拆分长表单元格并根据图像宽度调整宽度

我正在尝试绘制一个包含图像的长答案表。 在此处输入图片描述

我的努力是多列并将单元格拆分成小表格。我无法根据图像的宽度调整小表格的宽度。我的 MWE,请帮帮我!

\documentclass[12pt,a4paper,twoside]{report}
\usepackage[utf8]{vietnam}
\usepackage[left=2cm,right=1.5cm,top=2cm,bottom=2cm, a4paper]{geometry}  
\usepackage{longtable,tikz,multirow}
\begin{document}
\begin{longtable}{|c|c|p{0.7\linewidth}|p{0.1\linewidth}|}
\hline
\textbf{Ex} & \textbf{Ideas} & \textbf{Answer} & \textbf{Mark}\\
\hline
\multirow{3}{*}{\textbf{1}}& a) & Answer one & \textbf{1,0} \\
\cline{2-4}
& b) &
\multicolumn{2}{|l|}{
    \begin{tabular}{@{}p{0.3\linewidth}l}
    \parbox{0.4\linewidth}{\begin{tikzpicture}
    \draw (0,0) circle (2.5);
    \end{tikzpicture}}&
    \begin{tabular}{|p{0.4\linewidth}|p{0.1\linewidth}@{}|}
    Answer 2 &0.25\\
    \hline
    Answer 3 &0.25\\
    \hline
    Answer 4 &0.25\\
    \hline
    Answer 5 &0.25\\
    \hline\\
    \end{tabular}
    \end{tabular}
}\\
\hline
 & c)& Answer 6 & 1.0\\
\hline
\end{longtable}
\end{document}

先感谢您!

答案1

像这样?

在此处输入图片描述

根据以下答案问题

\documentclass[12pt,a4paper,twoside]{report}
\usepackage[utf8]{vietnam}
\usepackage[hmargin={2cm,1.5cm}, vmargin=2cm, a4paper]{geometry}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}
\usepackage{etoolbox}
\newrobustcmd\B{\DeclareFontSeriesDefault[rm]{bf}{b}% 
                \bfseries}                          %

\usepackage{tikz}

\usepackage{lipsum}

\begin{document}
    \begingroup
\DefTblrTemplate{firsthead, middlehead, lasthead}{default}{} % <---
\DefTblrTemplate{contfoot-text}{normal}{\scriptsize\textit{Continued on the next page}}
\SetTblrTemplate{contfoot-text}{normal}
%
\sisetup{detect-weight, % <--
         mode=text,     % <--
         table-format=1.2}
\begin{longtblr}{hlines, vlines,
        rowhead = {1},
        colspec = {Q[c,font=\bfseries] 
                   Q[c,m] 
                   X[1.2, l] X[0.8, h, j] Q[h, c, si]},
        row{1} = {font=\bfseries},
        hspan=minimal
                }
Ex  & Ideas & \SetCell[c=2]{l}  Answer               
                        &           &   Mark    \\
\SetCell[r=6]{h}    1
    & a)    & \SetCell[c=2]{j} 
              Answer 1  \lipsum[66] 
                        &           &\B 1.0     \\
    & \SetCell[r=4]{c} b)    
            & \SetCell[r=4]{c}    
                \begin{tikzpicture}[baseline]
            \draw (0,0) circle (2.5);
                \end{tikzpicture}%    
                        & Answer 2  &   0.25    \\
    &       &           & Answer 3  &   0.25    \\
    &       &           & Answer 4  &   0.25    \\
    &       &           & {Answer 5\\  \lipsum[1][1-2]}
                                    &   0.25    \\
    & c)    & \SetCell[c=2]{j}
              Answer 6  \lipsum[66]
                        &           &\B 1.0     \\
\end{longtblr}
    \endgroup
\end{document}

相关内容