3

I am sending my paper to mdpi.com. They have their own standard of paper formatting. One of my tables is very wide and exceededs the paper's width

enter image description here

There is big space on the left side. Is there a way I can shift the table only to the left to look like this?

enter image description here

Here is my script:

    \caption{ML algorithms and evaluation methods used for clinical notes.}
    \begin{center}
        \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
            \hline
            
            \multirow{2}{*}{\textbf{\thead{Research}}}  
            & \multicolumn{6}{c|}{\textbf{\thead{Statistical Algorithms}}} 
            & \multicolumn{4}{c|}{\textbf{\thead{Neural Networks}}}
            & \multicolumn{5}{c|}{\textbf{\thead{Evaluation Methods}}}  
            \\
            \cline{2-16} 
            
            &\textbf{\thead{RF}}&\textbf{\thead{LR}}&\textbf{\thead{DT}}&\textbf{\thead{SVM}}&\textbf{\thead{NB}}&\textbf{\thead{KNN}}&\textbf{\thead{CNN}}&\textbf{\thead{RNN}}&\textbf{\thead{LSTM}}&\textbf{\thead{GRU}}
            &\textbf{\thead{Recall}}&\textbf{\thead{Precision}}&\textbf{\thead{F1\\Score}}&\textbf{\thead{Accuracy}}&\textbf{\thead{AUC}}
            \\
            
            \hline
            
            \thead{\cite{426}}
            &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{red}{\ding{53}}} 
            &\thead{\textcolor{red}{\ding{53}}} 
            &\thead{\textcolor{red}{\ding{53}}} 
            &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{red}{\ding{53}}} \\
            
            \cline{1-16}                
            \thead{\cite{473}}  
            &\thead{\textcolor{red}{\ding{53}}} 
            &\thead{\textcolor{red}{\ding{53}}} 
            &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{red}{\ding{53}}} 
            &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{red}{\ding{53}}} \\
            
            
            \cline{1-16}
            
        \end{tabular}
        \label{table_Algorithms}
    \end{center}
\end{table}

Testing all these algorithms manually would require data science expertise along with a large

This is the script header

\documentclass[computers,article,submit,moreauthors,pdftex]{Definitions/mdpi} 
\maxdeadcycles=10000
\usepackage{amsmath,amssymb,pifont,amsfonts,makecell,ulem}

\usepackage{xcolor}

\usepackage{acronym}

\acrodef{AutoML}[AutoML]{automated machine learning}
\acrodef{ML}[ML]{machine learning}
\acrodef{AI}[AI]{artificial intelligence}
\acrodef{EHR}[EHR]{electronic health record}
\acrodef{NLP}[NLP]{natural language processing}
\acrodef{SVM}[SVM]{support vector machine}
\definecolor{mygreen}{RGB}{30, 155, 30}

\firstpage{1} 
\makeatletter 
\setcounter{page}{\@firstpage} 
\makeatother
\pubvolume{1}
\issuenum{1}
\articlenumber{0}
\pubyear{2021}
\copyrightyear{2020}
%\externaleditor{Academic Editor: Firstname Lastname}
\datereceived{} 
\dateaccepted{} 
\datepublished{} 

Edit:

I rotated them vertically but the header text touches the line above

    \begin{table}[!htb]
        \caption{ML algorithms and evaluation methods used for clinical notes.}
    \centering  % <---
\setlength\tabcolsep{3pt}


        \begin{center}

            \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
                \hline
                
                \multirow{2}{*}{\textbf{\thead{Research}}}  
                & \multicolumn{6}{c|}{\textbf{\thead{Statistical Algorithms}}} 
                & \multicolumn{4}{c|}{\textbf{\thead{Neural Networks}}}
                & \multicolumn{5}{c|}{\textbf{\thead{Evaluation Methods}}}  
                \\
                \cline{2-16} 
                
                &\rot{\textbf{\thead{RF}}}
                &\rot{\textbf{\thead{LR}}}
                &\rot{\textbf{\thead{DT}}}
                &\rot{\textbf{\thead{SVM}}}
                &\rot{\textbf{\thead{NB}}}
                &\rot{\textbf{\thead{KNN}}}
                &\rot{\textbf{\thead{CNN}}}
                &\rot{\textbf{\thead{RNN}}}
                &\rot{\textbf{\thead{LSTM}}}
                &\rot{\textbf{\thead{GRU}}}
                &\rot{\textbf{\thead{Recall}}}
                &\rot{\textbf{\thead{Precision}}}
                &\rot{\textbf{\thead{F1 Score}}}
                &\rot{\textbf{\thead{Accuracy}}}
                &\rot{\textbf{\thead{AUC}}}
                \\
                
                \hline
                
                \thead{\cite{426}}
                &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{red}{\ding{53}}} 
                &\thead{\textcolor{red}{\ding{53}}} 
                &\thead{\textcolor{red}{\ding{53}}} 
                &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{mygreen}{\checkmark}}    &\thead{\textcolor{red}{\ding{53}}} &\thead{\textcolor{red}{\ding{53}}} \\
                
                

enter image description here

7
  • 1
    Please tell us which document class and which LaTeX packages you load. How wide is the text block? How is mygreen defined? How or where is \ding defined?
    – Mico
    Feb 10 at 7:26
  • @Mico i added it to the question
    – asmgx
    Feb 10 at 7:47
  • 1
    Your table is to wide that it can be fit in the text block, so it spill out on the right page border.
    – Zarko
    Feb 10 at 8:11
  • @Zarko I know, that is why I want to shift it left
    – asmgx
    Feb 10 at 8:12
  • 1
    you need to make narrower ... for shift see changepage package.
    – Zarko
    Feb 10 at 8:20
4

See, if the following suit to your needs:

\documentclass{article}
\usepackage{geometry}

\usepackage{amsmath,amssymb,pifont,ulem}
\newcommand\Yes{\textcolor{red}{\ding{53}}}     % <---
\newcommand\No{\textcolor{teal}{\checkmark}}    % <---
\usepackage{makecell, multirow, rotating}       % <---
\renewcommand\theadfont{\bfseries}              % <---
\renewcommand\theadgape{}                       % <---
\usepackage{xcolor}

\begin{document}
    \begin{table}
\caption{ML algorithms and evaluation methods used for clinical notes.}
    \centering  % <---
    \setlength\tabcolsep{3pt}  % <---
    \settowidth\rotheadsize{\theadfont Accuracy}
        \begin{tabular}{|c| *{15}{>{\centering\arraybackslash}p{1.8em}|} }
            \hline
        \multirow{2}{*}{\thead{Research}}
            & \multicolumn{6}{c|}{\thead{Statistical Algorithms}}
            & \multicolumn{4}{c|}{\thead{Neural Networks}}
            & \multicolumn{5}{c|}{\thead{Evaluation Methods}}
            \\
            \cline{2-16}

            & \rothead{RF}      & \rothead{LR}  & \rothead{DT}      & \rothead{SVM}
            & \rothead{NB}      & \rothead{KNN} & \rothead{CNN}     & \rothead{RNN}
            & \rothead{LSTM}    & \rothead{GRU} & \rothead{Recall}  &\rothead{Precision} &\rothead{F1 Score} &\rothead{Accuracy}     & \rothead{AUC}   \\
            \hline
            \thead{\cite{426}}
            & \No   & \Yes  & \No   & \No   & \No   & \No   & \Yes  & \No
            & \Yes  & \No   & \No   & \No   & \Yes  & \No   & \No   \\

            \cline{1-16}
            \thead{\cite{473}}
            & \No   & \No   & \No   & \Yes  & \No   & \No   & \Yes  & \Yes
            & \Yes  & \No   & \No   & \No   & \Yes  & \No   & \No   \\
            \cline{1-16}
        \end{tabular}
        \label{table_Algorithms}
\end{table}
\end{document}

First two rows in above MWQE I use because I haven't used \documentclass. If table is still to wide, than try to reduce font size to \small:

enter image description here

2
  • Thanks, I used rotated header which indeed helped with reducing the table's width.. the only problem i have now is the space, coz the Accuracy word touching the line on top. I will edit my question
    – asmgx
    Feb 10 at 16:11
  • 1
    @asmgx, if you consider my answer as it is, you would'n t have your troubles ;-). In your MWE you forgot on the following code line from my MWE: \settowidth\rotheadsize{\theadfont Accuracy}. BTW, consider to remove all clutter in your MWE. For comparison see MWE in received answers.
    – Zarko
    Feb 10 at 16:21
6

You wrote,

"I cannot make [the table] narrower"

Yes you can -- by, say, getting rid of all \textbf directives and almost all \thead directives in the header cells, omitting all 17 vertical bars, setting \tabcolsep to 0pt and employing a tabular* environment, employing a \small font size directive. Separately, you could use the line-drawing macros of the booktabs package -- \toprule, \midrule, \cmidrule, \addlinespace, and \bottomrule -- instead of \hline and \cline in order to give the table a more open and inviting "look".

enter image description here

\documentclass[computers,article,submit,moreauthors,pdftex]{Definitions/mdpi} 

%% [preamble]

%% new:
\usepackage{booktabs,lipsum}
\newcommand\redcross{\textcolor{red}{\footnotesize\ding{53}}}
\newcommand\greencheck{\textcolor{mygreen}{\checkmark}}

\begin{document}

\begin{table}
\setlength\tabcolsep{0pt}
    \caption{ML algorithms and evaluation methods used for clinical notes.}
    \label{table_Algorithms}

    \small
        \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} l *{15}{c} }
            \toprule
            
            Research
            & \multicolumn{6}{c}{Statistical Algorithms} 
            & \multicolumn{4}{c}{Neural Networks}
            & \multicolumn{5}{c}{Evaluation Methods}  
            \\
            \cmidrule{2-7} \cmidrule{8-11} \cmidrule{12-16} 
            &RF&LR&DT&SVM&NB&KNN
            &CNN&RNN&LSTM&GRU
            &Recall&Prec.&\thead{F1\\Score}&Acc.&AUC
            \\
            \midrule
            \cite{426}
            & \redcross & \greencheck & \redcross   & \redcross   & \redcross 
            & \redcross & \greencheck & \redcross   & \greencheck & \redcross 
            & \redcross & \redcross   & \greencheck & \redcross   & \redcross \\
            \addlinespace                 
            \cite{473} 
            & \redcross & \redcross   & \redcross   & \greencheck & \redcross   
            & \redcross & \greencheck & \greencheck & \greencheck & \redcross    
            & \redcross & \redcross   & \greencheck & \redcross   & \redcross \\     
            \bottomrule           
        \end{tabular*}
\end{table}

\lipsum[2] % filler text
\end{document}
1
  • 3
    +1, because you "liberate" cells contents from jail of lines :-)
    – Zarko
    Feb 10 at 8:41

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.