糟糕的混乱的桌子

糟糕的混乱的桌子

我有下面的表格,我一直在努力让它看起来更好,但没有成功。文本在垂直方向上没有对齐,它有很多空白,我想覆盖它们。我会添加更多文本,但要等到我创建一个更好看、更吸引人的表格时才会添加。我不确定它看起来是这样是因为数字还是因为我在乳胶中使用表格的笨拙。表格的代码也很乱,让表格的使用变得非常混乱。如果enter image description here有人可以帮忙。

\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{adjustbox}{width=1\textwidth}
\begin{tabular}{|l|l|l|l|l|}
\hline
{\bf Model} & {\bf Main characteristics} & {\bf Mounted} & {\bf Folded} & {\bf Advantages and disadvantages}          \\ \hhline{=|=|=|=|=}

Blix vika+ & \begin{tabular}[c]{@{}l@{}}350W rear hub\\ Frame folds horizontally\\ Folds head tube and pedals\\ Wheels side by side but unaligned\end{tabular} & \includegraphics[width=2cm]{Figures/vika1.jpg} & \includegraphics[width=2cm]{Figures/vika+f.jpg}   & \begin{tabular}[c]{@{}l@{}}Easy to fold\\ Not very compact\\ Hard to transport when folded\end{tabular}   \\ \hline

Volt Metro     & \begin{tabular}[c]{@{}l@{}}250W rear hub\\ Frame folds horizontally\\ Folds head tube and pedals\\ Wheells alligned but not in parallel\end{tabular}  &  \includegraphics[width=2cm]{Figures/volt.jpg} &    \includegraphics[width=2cm]{Figures/voltmetro.jpg}      & \begin{tabular}[c]{@{}l@{}}Easy to fold\\ Not very compact\\ Hard to transport when folded\end{tabular}                   \\ \hline

Gi Flybike     & \begin{tabular}[c]{@{}l@{}}250W rear hub\\ Frame folds vertically\\ Wheels in parallel when folded\end{tabular}         &  \includegraphics[width=2cm]{Figures/gifly.jpg}        &   \includegraphics[width=2cm]{Figures/giflyf.jpg}         & \begin{tabular}[c]{@{}l@{}}Fast and easy to fold\\ Trolley\\ Low moving parts\\ Not very compact\\ Practical\end{tabular} \\ \hline
Mando Footlose & \begin{tabular}[c]{@{}l@{}}250W rear hub\\ Hybrid\\ Frame folds vertically\\ Folds head tube\end{tabular} &  \includegraphics[width=2cm]{Figures/mando.jpg}  &     \includegraphics[width=2cm]{Figures/mandof.jpg}     & \begin{tabular}[c]{@{}l@{}}Fast and easy to fold\\ Trolley\\ Low moving parts\\ Not very compact\\ Practical\end{tabular} \\ \hline

Go cycle       & \begin{tabular}[c]{@{}l@{}}250W front hub\\ Folds chainstay vertically \\ Folds head tube and seat\\ To fold completely it's necessary\\ to remove the wheels\end{tabular} &    \includegraphics[width=2cm]{Figures/gocycle.jpg}        &   \includegraphics[width=2cm]{Figures/gocyclef.jpg}        & \begin{tabular}[c]{@{}l@{}}Practical \\ Few moving parts \\ Hard to transport when folded\end{tabular}                    \\ \hline

Jivr Bike      & \begin{tabular}[c]{@{}l@{}}350W front hub\\ Folds chainstay vertically\\ Front frame folds horizontally\\ Chainless\end{tabular}                                         &    \includegraphics[width=2cm]{Figures/jivr.jpg}       &     \includegraphics[width=2cm]{Figures/jivrf.jpg}       & \begin{tabular}[c]{@{}l@{}}Very compact\\ Several moving parts\\ Hard to transport when folded\end{tabular}               \\ \hline

Weelin         & \begin{tabular}[c]{@{}l@{}}Power?? central motor\\ Folds chainstay vertically \\ Folds head tube, seat and pedalls\end{tabular}                                          &    \includegraphics[width=2cm]{Figures/weelin.jpg}      &       \includegraphics[width=2cm]{Figures/weelinf.jpg}    & \begin{tabular}[c]{@{}l@{}}Very compact\\ Several moving parts\\ Hard to transport when folded\end{tabular}               \\ \hline
\end{tabular}
\end{adjustbox}
\end{table}
\FloatBarrier

答案1

enter image description here

上图是通过以下方式获得的:

\documentclass{article}
\usepackage[showframe,
            margin=25mm]{geometry}
\usepackage[demo]{graphicx}
\usepackage{makecell,hhline,tabularx}
    \renewcommand\tabularxcolumn[1]{m{#1}}
    \newcolumntype{L}{>{\raggedright\arraybackslash}X}
    \renewcommand\theadfont{\normalsize\bfseries}
\usepackage[labelfont=bf]{caption}
\usepackage[export]{adjustbox}

\begin{document}
    \begin{table}[htb]
    \centering
    \setlength\tabcolsep{3pt}
\caption{My caption}
    \label{my-label}
\begin{tabularx}{\textwidth}{|>{\setlength\hsize{0.6\hsize}}L|
                              >{\setlength\hsize{1.2\hsize}}L|
                                c|c|
                              >{\setlength\hsize{1.2\hsize}}L|}
\hline
\thead{Model} 
    &   \thead{Main\\ characteristics} 
        &   \thead{Mounted} 
            & \thead{Folded} 
                & \thead{Advantages and\\ disadvantages}          
                                                    \\  \hhline{=|=|=|=|=}
Blix vika+ 
    &   350W rear hub\newline 
        Frame folds horizontally\newline 
        Folds head tube and pedals\newline 
        Wheels side by side but unaligned
        &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt] {Figures/vika1.jpg}
            &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt] {Figures/vika+f.jpg}
                &   Easy to fold\newline  
                    Not very compact\newline 
                    Hard to transport when folded   \\ \hline
Volt Metro     
    &   250W rear hub\newline  
        Frame folds horizontally\newline  
        Folds head tube and pedals\newline  
        Wheells alligned but not in parallel
        &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/volt.jpg} 
            &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/voltmetro.jpg}
                &   Easy to fold\newline  
                    Not very compact\newline  
                    Hard to transport when folded   \\ \hline
Gi Flybike     
    &   250W rear hub\newline  
        Frame folds vertically\newline   
        Wheels in parallel when folded
        &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/gifly.jpg}        
            &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/giflyf.jpg}
                &   Fast and easy to fold\newline  
                    Trolley\newline   
                    Low moving parts\newline  
                    Not very compact\newline  
                    Practical                           \\ \hline
Mando Footlose 
    &   250W rear hub\newline  
        Hybrid\newline  
        Frame folds vertically\newline  
        Folds head tube
        &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/mando.jpg}  
            &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/mandof.jpg}
                &   Fast and easy to fold\newline  
                    Trolley\newline  
                    Low moving parts\newline  
                    Not very compact\newline  
                    Practical                           \\ \hline
Go cycle       
    &   250W front hub\newline  
        Folds chainstay vertically\newline  
        Folds head tube and seat\newline  
        To fold completely it's necessary remove the wheels
        &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/gocycle.jpg}        
            &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/gocyclef.jpg}
                &   Practical\newline  
                    Few moving parts\newline  
                    Hard to transport when folded       \\ \hline
Jivr Bike      
    &   350W front hub\newline  
        Folds chainstay vertically\newline  
        Front frame folds horizontally\newline  
        Chainless
        &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/jivr.jpg}       
            &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/jivrf.jpg}
                &   Very compact\newline  
                    Several moving parts\newline  
                    Hard to transport when folded           \\ \hline
Weelin         
    &   Power?? central motor\newline  
        Folds chainstay vertically\newline  
        Folds head tube, seat and pedalls                                          &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/weelin.jpg}      
            &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/weelinf.jpg}
                &   Very compact\newline  
                    Several moving parts\newline  
                    Hard to transport when folded           \\ \hline
\end{tabularx}
    \end{table}
\end{document}

对于图像的垂直定位以及其上下边距,我利用adjustbox包,而不是tabular我更喜欢使用tabularx。它的好处是显而易见的:使用X列类型使嵌套的表格变得多余,并且通过简单的重新定义使\renewcommand\tabularxcolumn[1]{m{#1}}单元格内容垂直居中。

附录: 也许你会发现使用“逐项列出”环境列出所展示自行车的功能很有吸引力(仅在表格的最后一行进行测试):

enter image description here

为了如此展示自行车的功能,您需要在序言中添加:

\usepackage{enumitem}               % <-- added, for show itemize of bikes features
    \newcommand{\tablistcmd}{\leavevmode\par\vspace{-\baselineskip}}
    \setlist{nosep, %topsep=0pt, partopsep=0pt,
             leftmargin=*,
             before=\tablistcmd, after=\tablistcmd%
             }

并更改表格,如您在表格最后一行所见:

Weelin         
    &   \begin{itemize}
        \item   Power central motor 
        \item   Folds chainstay vertically 
        \item   Folds head tube, seat and pedals
        \end{itemize}                                          &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/weelin.jpg}
            &   \includegraphics[width=20mm,height=25mm,valign=M,margin=0pt 5pt]  {Figures/weelinf.jpg}
                &   \begin{itemize}
                    \item   Very compact
                    \item   Several moving parts
                    \item   Hard to transport when folded
                    \end{itemize}                           \\ \hline

相关内容