如何调整表格内绘图的大小?

如何调整表格内绘图的大小?

如何调整下表中的绘图大小:

 \begin{longtable}{ | c | m{3cm}  | }
    \hline
    Graph & Items  \\ 
    \hline
    \begin{minipage}{.3\textwidth}
        \includegraphics[width=\linewidth]{sinx}
    \end{minipage} &  \begin{itemize} \item Item 1 \item Item 2 \item Item 3 \item Item 4 \item Item 5 \item Item 6 \item Item 7 \item Item 8  \item Item 9 \item Item 10  \end{itemize}   \\
    \hline
\end{longtable}

结果是

在此处输入图片描述

编辑:我真正担心的是图像上方的空间。

答案1

在此 MWE 中,可以通过添加(正或负)垂直空间来调整图像的位置。

\vspace*{0pt}

X0

\vspace*{150pt}

X150

\vspace*{-150pt}

最小X

\documentclass[12pt,a4paper]{article}

\usepackage{graphicx}
\usepackage{array}
\usepackage{longtable}

\begin{document}
    
     \begin{longtable}{ | c | m{3cm}  | }
        \hline
        Graph & Items  \\ 
        \hline
        \begin{minipage}[c]{.3\textwidth}   
        %\vspace*{150pt}    % adjust top space      
            \includegraphics[width=\linewidth]{example-image-a}                 
        \end{minipage} &
        \parbox[b]{\linewidth}
        {\begin{itemize}
            \item Item 1 
            \item Item 2 
            \item Item 3 
            \item Item 4 
            \item Item 5 
            \item Item 6 
            \item Item 7 
            \item Item 8  
            \item Item 9 
            \item Item 10
            \end{itemize}}
   \\
        \hline
    \end{longtable}

\end{document}

答案2

不清楚图像应该垂直放置在哪里。如果您喜欢将其放置在单元格的垂直中间,请参见以下解决方案:

\documentclass{article}
\usepackage{graphicx}
\usepackage{array, longtable}
\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{longtable}{%
\setlist[itemize]{nosep,
    leftmargin=*,
    label=\textbullet,
    before={\begin{minipage}[t]{\hsize}},%https://tex.stackexchange.com/questions/531952/
    after ={\end{minipage}}
                  } }

\begin{document}
\begin{longtable}{ | m{0.3\linewidth} | m{3cm}  | }
    \hline
    Graph & Items  \\
    \hline
\includegraphics[width=\linewidth]{example-image-duck}
    &  \begin{itemize} 
    \item Item 1 
    \item Item 2 
    \item Item 3 
    \item Item 4 
    \item Item 5 
    \item Item 6 
    \item Item 7 
    \item Item 8  
    \item Item 9 
    \item Item 10  
        \end{itemize}   \\
    \hline
\end{longtable}
\end{document}

在此处输入图片描述

如果您希望将其放在单元格顶部,请尝试以下操作:

\documentclass{article}
\usepackage[export]{adjustbox}  % it load graphicx too
\usepackage{array, longtable}
\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{longtable}{%
\setlist[itemize]{nosep,%
    leftmargin=*,
    label=\textbullet,
    before={\begin{minipage}[t]{\hsize}},%https://tex.stackexchange.com/questions/531952/
    after ={\end{minipage}}
                  } }

\begin{document}
\begin{longtable}{ | p{0.3\linewidth} | p{3cm}  | }
    \hline
    Graph & Items  \\
    \hline
\includegraphics[width=\linewidth, valign=t, margin=2pt]{example-image-duck}
    &  \begin{itemize} 
    \item Item 1 
    \item Item 2 
    \item Item 3 
    \item Item 4 
    \item Item 5 
    \item Item 6 
    \item Item 7 
    \item Item 8  
    \item Item 9 
    \item Item 10  
        \end{itemize}   \\
    \hline
\end{longtable}
\end{document}

在此处输入图片描述

相关内容