-1

I am trying to do a table. How can i set the column width easily or automatically so that the text does not go into the next line ? With this code I have, I get the image below.

\begin{table}[t]
    \small
    \begin{tabu} to \columnwidth { | X[l] | X[c] | X[c] | X[c] |}
        \hline
        \textbf{Dissimilarity Term} & \textbf{USE} & \textbf{ASA} & \textbf{BR} \\
        \hline
        L1 with Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L2 with Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L1 without Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L2 without Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L1 with Harmonic Mean and 9x9 Sobel & 6712 & 6712 & 6712 \\
        \hline
    \end{tabu}
      \medskip
    \caption{B}
    \label{tab:componentruntime}        
\end{table}

enter image description here

Is there a simple or a smart command that tells the code to print a certain column without going into the next line ?

\begin{table}[t]
    \small
    \begin{tabu} to \columnwidth { | X[l] \fit_text | X[c] | X[c] | X[c] |}
        \hline
        \textbf{Dissimilarity Term} & \textbf{USE} & \textbf{ASA} & \textbf{BR} \\
        \hline
        L1 with Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L2 with Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L1 without Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L2 without Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L1 with Harmonic Mean and 9x9 Sobel & 6712 & 6712 & 6712 \\
        \hline
    \end{tabu}
      \medskip
    \caption{B}
    \label{tab:componentruntime}        
\end{table}
1
  • 2
    Use the l specifier for first column, I suppose.
    – Bernard
    Commented Aug 14, 2017 at 10:02

1 Answer 1

2

After reading online I found the solution. I can extend the width of the 1st column by twice its original using X[2l]. The remaining columns will be automatically adjusted.

\begin{table}[t]
    \small
    \begin{tabu} to \columnwidth { | X[2l] | X[c] | X[c] | X[c] |}
        \hline
        \textbf{Dissimilarity Term} & \textbf{USE} & \textbf{ASA} & \textbf{BR} \\
        \hline
        L1 with Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L2 with Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L1 without Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L2 without Harmonic Mean & 6712 & 6712 & 6712 \\
        \hline
        L1 with Harmonic Mean and 9x9 Sobel & 6712 & 6712 & 6712 \\
        \hline
    \end{tabu}
      \medskip
    \caption{B}
    \label{tab:componentruntime}        
\end{table}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .