1

I have created a table. I used template of springer. I want to fix the width of my table by using the weights option, but I don't know how to do that. I used textwidth but no positive results.

This is my code:

\begin{filecontents*}{Draft Paper.eps}
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 19 19 221 221
%%CreationDate: Mon Sep 29 1997
%%Creator: programmed by hand (JK)
%%EndComments
gsave
newpath
  20 20 moveto
  20 220 lineto
  220 220 lineto
  220 20 lineto
closepath
2 setlinewidth
gsave
  .4 setgray fill
grestore
stroke
grestore
\end{filecontents*}
\documentclass[twocolumn]{svjour3}          % twocolumn
\usepackage{multirow}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\newcommand{\tabitem}{~~\llap{\textbullet}~~}

\begin{document}
\begin{center}
\begin{table*}[htp]
%\scriptsize        
\centering
%\begin{tabular}{|l|l|l|l|l|l|l|l|l|}
\begin{tabular}  {  |p{0.04\textwidth}|
p{0.04\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.13\textwidth}|p{0.13\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.02\textwidth}|} 


%%{  |p{0.04\textwidth}|
%%p{0.04\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.13\textwidth}|p{0.13\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.02\textwidth}|} 



\hline
Text Text Text
&

Text Text Text
&
Text Text Text
& 
Text  
& 
Text Text  & Text Text  & Text Text  & Text Text  & Text Text  

\\ \hline

{\multirow {10}{*}{\rotatebox{90}{ {Text Text } }}}  & 


%[origin=c] [3em]{\cellcolor{yellow}\begin{sideways}TEST\end{sideways}}


%{\multirow {2}[3em]{\cellcolor{yellow}\begin{sideways}TEST\end{sideways}}}  & 

{\multirow [c]{14}{*}{\rotatebox{90}{ Text   }}}


 & 

Text Text Text .
& 
Text Text .
& 

%\begin{tabular} {@{}l@{}}

 
\begin{tabitemize}

\item
RSS. 
\item Text Text .

\item Text Text .
\end{tabitemize}
 & 
 
 

%\begin{tabular}{@{}l@{}}
 
\begin{tabitemize}
\item Text Text .
\item Text Text  .  
\item Text Text  %\hspace{0.28cm}
rate.
\end{tabitemize}
%\end{tabular}  

&   

Text Text Text   Text Text  Text Text .

& 
Text    Text Text  Text Text .

& 

Text 



\\ \cline{3-9}&  & 

Text Text Text .
& 
Text  Text  Text  (10 Text   Text  5 Text ).
& 
 
 
 
 %\begin{tabular}{@{}l@{}}
 
\begin{tabitemize}
\item Text .
\item Text  Text . 
\item Text .
 
\end{tabitemize}
%\end{tabular}

& 

Text  Text   Text   Text .
&
Text  Text   Text   Text    Text  Text .
& 
Text  Text   Text  Text   Text  Text   Text .

& 

Text  \\ 


\cline{1-1} \cline{3-9} 

\multirow{4}{*} {\rotatebox[origin=c]{90} {   Text   }}  &  
&
Text -Text . 
 &
Text  Text   Text .
& 


Text  Text   Text   Text  in $t_{n}$.
& 

Text  Text   Text  Text   Text  Text  $t_{n+1}$.
& 
Text  Text  Text   Text  Text  Text   Text  Text .
& 
%\multicolumn{1}{c|}{
//
%} 
& 

Text  

\\ 
\hline

%\multirow{5}{*}{\rotatebox{90}{Example 3}}

\multirow{8}{*} {\rotatebox[origin=c]{90} {   Text    }} & 

\multirow{8}{*} {\rotatebox[origin=c]{90} {   Text  }}
& 
Text Text . 
&
Text Text Text .
& 
%\begin{tabular} {@{}l@{}}
 
\begin{tabitemize}
\item Text Text . 
\item Text . 
\item Text . 
\item Text . 
\item Text  Text . 
\item Text  Text . 
 
\end{tabitemize}
%\end{tabular}
&
Text  Text  Text   (Text , Text ,  Text , Text Text Text ).
& 
Text Text Text .
& 
Text Text Text Text .

& 


Text 

\\ \hline

\end{tabular}
\caption{Text Text Text Text }
\label{Text }   
\end{table*}
\end{center}

\end{document}

This is the table, I don't know why the width of table is bigger than the width of the page.

enter image description here

3
  • 1
    Because the sum of all the columns, all the space between columns and vertical rules is more than the text width. – Sveinung Jun 20 '20 at 22:40
  • @Sveinung How can I know the width of the textwidth ? – stevGates Jun 20 '20 at 22:52
  • You have to reduce the width of the tabular, reduce font, tabcolsep etc. I had an example, but it did not work, give me a minute or two – Sveinung Jun 20 '20 at 22:59
1
  • Your document example is not complete. It not contain definition for tabitemize environment.
  • For table environment the tabularx is used. For it is prescribed table width (to be equal to \textwidth} and defined Xcolumn tape (modified toL` which align cells' text to the left)
  • List in cells are defined by use of the enumitem package and remamed to tabitem (if you prefer, you can change name to tabitemize).
  • For more vertical space above/below cells' contents are used \makegapedcells macro defined in the makecell package
  • For the first and the last horizontal line are used Xhline{<width>} defined in the makecell package for emphasize these lines
  • From MWE (Minimal Working Example) are removed all commented lines, code is formated that is more compact and easy to read/maintain.
\documentclass[twocolumn]{svjour3}  
\usepackage{graphicx}
\usepackage{makecell, multirow, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}  % new
\usepackage{enumitem}                               % new
\newlist{tabitem}{itemize}{1}   % <-- defined new list
\setlist[tabitem]{nosep,        % <-- new list setup
                  leftmargin=*,
                  label=$\bullet$,
                  before=\begin{minipage}[t]{\linewidth}, 
                  after=\end{minipage}                   
                  }

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{table*}
    \setcellgapes{2pt}
    \makegapedcells
    \setlength\tabcolsep{4pt}
\begin{tabularx}{\linewidth}{ 
        *{2}{|p{0.04\textwidth}}
        *{6}{|L}
            |p{0.04\textwidth}|}
    \Xhline{1pt}
Text Text Text
    &   Text Text Text
        &   Text Text Text
            &   Text
                &   Text Text  
                    & Text Text  
                        & Text Text  
                            & Text Text  
                                & Text Text     \\ 
    \hline
\multirow{7}{=}{\centering\rotatebox{90}{Text Text}}  
    &   \multirow{10}{=}{\centering\rotatebox{90}{Text}}
        &   Text Text Text
            &   Text Text
                &   \begin{tabitem}
                \item   RSS.
                \item Text Text 
                \item Text Text 
                    \end{tabitem}
                    &   \begin{tabitem}
                    \item Text Text 
                    \item Text Text 
                    \item Text Text rate.
                        \end{tabitem}
                        &   Text Text Text Text Text Text Text 
                            &   Text Text Text Text Text
                                &   Text    \\ 
    \cline{3-9}
    &   &   Text Text Text 
            &   Text Text Text (10 Text Text 5 Text).
                &   \begin{tabitem}
                \item Text
                \item Text Text
                \item Text
                    \end{tabitem}
                    &   Text Text Text Text
                        &   Text Text Text Text Text Text
                            &   Text Text Text Text Text Text Text
                                &   Text  \\
    \cline{1-1} \cline{3-9}
\multirow{3}{=}{\centering\rotatebox[origin=c]{90}{Text}}  
    &   &   Text -Text
            &   Text Text Text
                &   Text Text Text Text in $t_{n}$.
                    &   Text Text Text Text Text Text $t_{n+1}$.
                        &   Text Text Text Text Text Text Text Text
                            &   &   Text    \\
    \hline
\multirow{6}{=}{\centering\rotatebox[origin=c]{90}{Text}} 
    &   \multirow{6}{=}{\centering\rotatebox[origin=c]{90}{Text}}
        &   Text Text
            &   Text Text Text
                &   \begin{tabitem}
                \item Text Text .
                \item Text .
                \item Text .
                \item Text .
                \item Text Text .
                \item Text Text .
                    \end{tabitem}
                    &   Text Text Text (Text, Text, Text, Text Text Text).
                        &   Text Text Text
                            &   Text Text Text Text
                                &   Text    \\ 
    \Xhline{1pt}
\end{tabularx}
\caption{Text Text Text Text }
\label{Text }
    \end{table*}
\end{document}

enter image description here

(red lines show page layout)

10
  • I don't understand what you modified – stevGates Jun 21 '20 at 0:30
  • @Brm-Covißio, hm, all is explained in answer: let me repeat: (i) for table is used tabularx by which is prescribed width of table (see code), defined are list tabitem (which is missing in your MWE), added are vertical spaces above and below cells' contents by use the \makegapedcells macro (which is not mentioned in explanation, now added) and clean-up is your code. – Zarko Jun 21 '20 at 0:44
  • I wont use tabularx, and I can't run the code – stevGates Jun 21 '20 at 0:57
  • @Brm-Covißio, sorry but then my answer cant' help you. You then can stick with another answer (which not use tabularx package). However, there is not any reason why you should not use standard LaTeX package. But it is all up to you. – Zarko Jun 21 '20 at 1:01
  • 1
    @Brm-Covißio The code in the answer works: if the code in your document doesn't work you have an error in code you have not shown. The error you show isn't really related to tabularx it is an error in an enumitem customisation of itemize – David Carlisle Jun 21 '20 at 7:45
0

Here is an MWE, I use tabular* \textwidth wide. I reduced \tabcolsep and the fontsize. In addition, the command @{\extracolsep{\fill}} ensure the tabular uses all available space. The new column (N) set the content ragged right. In addition, I increased the size of the last column:

enter image description here

\documentclass[twocolumn]{article}          % twocolumn
\usepackage{multirow, graphicx, array}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\newcommand{\tabitem}{~~\llap{\textbullet}~~}

\newcolumntype{N}[1]{>{\raggedright\arraybackslash}p{0.#1\textwidth}}

\begin{document}
\begin{center}
\footnotesize
\begin{table*}[htp]
 \centering
\setlength{\tabcolsep}{3pt}
\begin{tabular*}{\textwidth}  {@{\extracolsep{\fill}}|N{04}|
N{04}|N{12}|N{12}|N{13}|N{13}|N{12}|N{12}|N{04}|} 

\hline
Text Text Text
&

Text Text Text
&
Text Text Text
& 
Text  
& 
Text Text  & Text Text  & Text Text  & Text Text  & Text Text  

\\ \hline

{\multirow {10}{*}{\rotatebox{90}{ {Text Text } }}}  & 


{\multirow [c]{14}{*}{\rotatebox{90}{ Text   }}}

 & 

Text Text Text .
& 
Text Text .
& 


\begin{itemize}

\item
RSS. 
\item Text Text .

\item Text Text .
\end{itemize}
 & 
 
\begin{itemize}
\item Text Text .
\item Text Text  .  
\item Text Text  
rate.
\end{itemize}

&   
Text Text Text   Text Text  Text Text .
& 
Text    Text Text  Text Text .
& 
Text 

\\ \cline{3-9}&  & 

Text Text Text .
& 
Text  Text  Text  (10 Text   Text  5 Text ).
& 
 
 \begin{itemize}
\item Text .
\item Text  Text . 
\item Text .
 
\end{itemize}
& 
Text  Text   Text   Text .
&
Text  Text   Text   Text    Text  Text .
& 
Text  Text   Text  Text   Text  Text   Text .
& 
Text  \\ 
\cline{1-1} \cline{3-9} 
\multirow{4}{*} {\rotatebox[origin=c]{90} {   Text   }}  &  
&
Text -Text . 
&
Text  Text   Text .
& 
Text  Text   Text   Text  in $t_{n}$.
& 
Text  Text   Text  Text   Text  Text  $t_{n+1}$.
& 
Text  Text  Text   Text  Text  Text   Text  Text .
& 
& 
Text  

\\ \hline

\multirow{8}{*} {\rotatebox[origin=c]{90} {   Text    }} & 

\multirow{8}{*} {\rotatebox[origin=c]{90} {   Text  }}
& 
Text Text . 
&
Text Text Text .
& 
 
\begin{itemize}
\item Text Text . 
\item Text . 
\item Text . 
\item Text . 
\item Text  Text . 
\item Text  Text . 
 
\end{itemize}
&
Text  Text  Text   (Text , Text ,  Text , Text Text Text ).
& 
Text Text Text .
& 
Text Text Text Text .
& 
Text 

\\ \hline

\end{tabular*}
\caption{Text Text Text Text }
\label{Text }   
\end{table*}
\end{center}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.