0

Hi I have the following table. Is there a way to set the width of the column. I want to minimize the column width so that it could fit my journal template.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tabular}

\begin{document}
 \begin{table}[ht!]
      \caption{Sensitivity Analysis of the Parameters in the Inventory model} 
      \label{tab:my tab}
      \begin{tabular}{|lcc{1cm}||cccccc|}
          \hline
          \multirow{3}{*}{Parameters}&
          \multirow{3}{*}{Values}&
          \multirow{3}{*}{\% Change}&
          \multicolumn{6}{|c|}{Change in}\\ \cline{4-9}
          &&&$T$&$t_1$&$TVC$&$S$&$P$&$Q$ \\ \hline
\end{tabular}
\end{document}
  • Do not write text between $...$. If you want italicized use \textit{...}. And to set the width of a column you have to use p{1cm}, not c{1cm}. – Phelype Oleinik Jun 30 '18 at 19:35
  • @PhelypeOleinik sorry i have edited that. so do you mean that the command should be \begin{tabular}{|p{1cm}p{1cm}p{1cm}||cccccc|} ? – shahrina ismail Jun 30 '18 at 20:02
  • 1
    If you want to make the first three columns with 1 cm wide, yes. But LaTeX builds tables so that the width of the column is adjusted to the contents of the table. It would help if you showed us the journal template so that we can make it fit the margins. Meanwhile you can take a look at this thread to find some methods to reduce the size of tables. – Phelype Oleinik Jun 30 '18 at 20:09

1 Answers1

1
  • i suspect, that your document has two columns
  • prescribe column width, which is smaller than width of cells content can lead to new problems (you can't always relay on hyphenation)
  • a solution can be use tabular* with prescibe table width equal column width, set \tabcolsep to 3pt and use @{\extracolsep{\fill}}:

    \documentclass[twocolumn]{article} % <---
    \usepackage{amsmath}
    \usepackage{multirow} % <---
    
    %---------------- show page layout. don't use in a real document!
    \usepackage{showframe}
    \renewcommand\ShowFrameLinethickness{0.15pt}
    \renewcommand*\ShowFrameColor{\color{red}}
    %---------------------------------------------------------------%
    \usepackage{lipsum}
    
    \begin{document}
    \lipsum[1]
     \begin{table}[htb]
     \small % <---
     \setlength\tabcolsep{3pt} % <---
          \caption{Sensitivity Analysis of the Parameters in the Inventory model}
          \label{tab:my tab}
          \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} % <---
                                        |lcc||cc cc cc|}
              \hline
              \multirow{2}{*}{\textit{Parameters}}   &
              \multirow{2}{*}{\textit{Values}}       &
              \multirow{2}{*}{\textit{\% Change}}    &
              \multicolumn{6}{c|}{Change in}              \\ \cline{4-9}
              & &   & $T$   & $t_1$ & $TVC$ & $S$ & $P$ & $Q$   \\ \hline
    \end{tabular*}
    \end{table}
    \lipsum[2-8]
    \end{document}
    

which gives:

enter image description here

(red lines indicate text borders)

Zarko
  • 296,517