0

I would like to obtain some more space between the chemical symbol "Nb" and the horizontal line from the cell above. Using \stretcharray command has helped a little to add this spce but increasing the number too much would result in a too big table the same holds true for "Nb2O5" and for all other chemical symbols. Is there a method to add this space, in a more apt way?

 \documentclass[10pt,a4paper]{article}
 \usepackage{blindtext}
 \usepackage{setspace}
    \begin{document}
\renewcommand{\arraystretch}{1.2}% for the vertical padding of table cells

    \newcommand*{\myparbox}[2][12mm]{\parbox{#1}{{\footnotesize  \bfseries #2}}}

    \begin{table}[H]
        \setstretch{0.85}
        \caption{Input parameters used for the GA optimizer.}
        \footnotesize% IMS: need this to get the 9pt text size in table cells % TODO is correct ?
        \centering
        \begin{tabular}{|l|c|c|l|}
            \hline
            & {\myparbox[10mm]{Material}} & {\myparbox{Property}} & {\myparbox{Value}} \\
            \hline

            \parbox[t]{2mm}{ \multirow{7}{*}{\rotatebox[origin=c {90}{Scenario 1}}} & Nb & $m_r$ & 1 \\
                &                                       & $\Psi$ & $4.33 \ eV$ \\
                & NbN                                   & $m_r$  & $1$\\
                &                                       & $\Psi$ & $4.7 \ eV$  \\
                \cline{2-4}
                & Nb\textsubscript{2}O\textsubscript{5} & $m_r$  & $1$\\
                &                                       & $\chi$ & $4.23 \ eV$ \\
                &                                       & $K$    & $25$ \\
            \hline
            \parbox[t]{2mm}{\multirow{8}{*}{\rotatebox[origin=c]{90}{Scenario 2}}} & Al & $m_r$ & 1 \\
                &   & $\Psi$ & $5 \ eV$ \\
                \cline{2-4}
                & Nb\textsubscript{2}O\textsubscript{5} & $m_r$  & 1\\
                &                                       & $\chi$ & $4.44 \ eV$ \\
                &                                       & $K$    & 25 \\
                & Al\textsubscript{2}O\textsubscript{3} & $m_r$  & 1\\
                &                                       & $\chi$ & $2.32 \ eV$ \\
                &                                       & $K$    & 9.7 \\
            \hline
        \end{tabular}
        \label{tab_inputpar}
        %\vspace{-\baselineskip}% remove one line of space below this table
    \end{table}
    \end{document}

Apologies in advance for any unneccessary packages becasuse I cleaned the unneccessary packages rapidly before posting. Many thanks in advnace.

  • No apologies :-) we are here to help you. – Sebastiano Nov 24 '18 at 20:08
  • Your code contains a lot of errors. – Sigur Nov 24 '18 at 20:25
  • OT: you should use a dedicated package like mhchem for typesetting chemical formula, Ditto for your units with siunitx – Troy Nov 24 '18 at 20:51
1

i would redesign your table as follows:

enter image description here

\documentclass[a4paper]{article}
\usepackage[skip=1ex]{caption}
\usepackage[version=4]{mhchem}
\usepackage{siunitx}
\usepackage{rotating}
\usepackage{booktabs, makecell, multirow}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\begin{document}
    \begin{table}
    \caption{Input parameters used for the GA optimizer.}
    \label{tab_inputpar}
\centering
%\footnotesize% IMS: need this to get the 9pt text size in table cells % TODO is correct ?
\renewcommand{\arraystretch}{0.9}% for the vertical padding of table cells
\settowidth\rotheadsize{Scenario 2}
\begin{tabular}{l c >{$}c<{$} l }
    \toprule
        & \thead{Material}   & \text{\thead{Property}}  & \thead{Value}   \\
    \midrule
    \multirow{7}{*}{\rotcell{Scenario 1}}
        & \ce{Nb}       & m_r     & 1 \\
        &               & \Psi    & \SI{4.33}{eV}   \\
    \addlinespace
        & \ce{NbN}      & m_r     & 1\\
        &               & \Psi    & \SI{4.7}{eV}    \\
    \addlinespace
        & \ce{Nb2O5}    & m_r     & 1\\
        &               & \chi    & \SI{4.23}{eV}   \\
        &               & K       & 25              \\
    \midrule
    \multirow{8}{*}{\rotcell{Scenario 2}}
        & Al            & m_r     & 1               \\
        &               & \Psi    & \SI{5}{ eV}     \\
    \addlinespace
        &\ce{Nb2O5}     & m_r     & 1\\
        &               & \chi    &  \SI{4.44}{eV}  \\
        &               & K       & 25              \\
    \addlinespace
        & \ce{Al2O3}    & m_r     & 1               \\
        &               & \chi    &  \SI{2.32}{eV}  \\
        &               & K       & 9.7             \\
    \bottomrule
\end{tabular}
 \end{table}
\end{document}

in code are consider all comment below your question.

1

I propose this simpler code, based on makecell for the cells padding and formatting, siunitx and chemformula:

 \documentclass[10pt, a4paper]{article}
 \usepackage{blindtext}
 \usepackage{setspace}
 \usepackage{siunitx, chemformula}
 \usepackage{float, multirow, rotating, caption, makecell}

\begin{document}

\newcommand*{\myparbox}[2][12mm]{\parbox{#1}{{\footnotesize \bfseries #2}}}

\begin{table}[H]
    \caption{Input parameters used for the GA optimizer.}
    \setcellgapes{2pt}\makegapedcells
    \footnotesize% IMS: need this to get the 9pt text size in table cells % TODO is correct ?
\renewcommand{\theadfont}{\bfseries}
    \centering
    \begin{tabular}{|l|c|c|l|}
        \hline
        & \thead{Material} & \thead{Property} & \thead{Value} \\
        \hline

        \parbox[t]{2mm}{ \multirow{7}{*}{\rotatebox[origin=c]{90}{Scenario 1}}} & \ch{Nb} & $m_r$ & 1 \\
            & & $\Psi$ & \SI{4.33}{\eV} \\
            & \ch{NbN} & $m_r$ & \Gape[1ex][0pt]{1}% \bigstrut[t]
            \\
            & & $\Psi$ & \SI{4.7}{\eV} \\
            \cline{2-4}
            &\ch{Nb2O5} & $m_r$ & $1$\\
            & & $\chi$ & \SI{4.23}{\ eV} \\
            & & $K$ & $25$ \\
        \hline
        \parbox[t]{2mm}{\multirow{8}{*}{\rotatebox[origin=c]{90}{Scenario 2}}} & Al & $m_r$ & 1 \\
            & & $\Psi$ & \SI{5}{\eV} \\
            \cline{2-4}
            & \ch{Nb2 O5} & $m_r$ & 1\\
            & & $\chi$ & \SI{4.44}{\eV} \\
            & & $K$ & 25 \\
            & \ch{Al2 O3} & $m_r$ & \Gape[1ex][0pt]{1}\\
            & & $\chi$ & \SI{2.32}{\eV} \\
            & & $K$ & 9.7 \\
        \hline
    \end{tabular}
    \label{tab_inputpar}
    %\vspace{-\baselineskip}% remove one line of space below this table
\end{table}

\end{document} 

enter image description here

  • Really wonderful solutions! @Bernard You solve the issue and keep to the regulations set by the organizing community. Zarko's Really impressive solution. Although both solutions work for me, and I am puzzled whose answer shall I accept. However, I will go for that of Zarko although I am not sure they will accept it the way it is as it has slightly different technique. – Mazen Nov 26 '18 at 16:03
  • @Mazen: Zarko's solution with booktabs is really nice– and I would have proposed a similar solution, but decided to stick to vertical rules since you used them, and the resulting table, while looking not so professional, isn't really ugly. – Bernard Nov 26 '18 at 17:31

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.