0

I am a newcomer in Latex. I am writing a paper that normally has two columns. I put a table, and it was ok for the tables that I wanted to place in one column, but I want to add a table that fits into two columns. Please help me. Thank you in advance.

    \documentclass[lettersize,journal]{IEEEtran}
\usepackage{amsmath,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{array}
\usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}
\usepackage{textcomp}
\usepackage{stfloats}
\usepackage{url}
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage{cite}
\usepackage{xcolor,colortbl}
\begin{table}[ht]
    \caption{Experimental Value of Components\label{tab:Comparison}}
    \centering
    \begin{tabular}{|c|>{\columncolor[gray]{0.8}}c|c|c|c|c|c|c|c|c|c|}
        \hline
        \cellcolor[gray]{0.95} Ref. & \cellcolor[gray]{0.95} Number of&Voltage Gain (G)&Duty Cycle Range&Maximum Voltage Stress on&Total Voltage Stress on Semiconductors&Low Pulsating Input Current&.&..&..&..\\
        \hline
        \hline
        Output Power, $P_{o}$  & 400 W&&&&&&&&&\\
        \hline
        Input-output voltage &&&&&&&&&& \\
        \hline
        & &&&&&&&&& \\
        \hline
        & &&&&&&&&& \\
        \hline
        &&&&&&&&&& \\
        \hline
        & &&&&&&&&&\\
        \hline
        &&&&&&&&&& \\
        \hline
        &&&&&&&&&& \\
        \hline
    \end{tabular}
\end{table}

1 Answers1

1

Here's an example of a table that spans both columns. This is done by table* environment. Since you have also added stfloats, starred floats gain an additional argument [b], which moves them to the bottom of a page.

Due to a large number of columns, I would suggest to reduce length of all headers, e.g. by substituting full phrases with acronyms and adding explanation at the bottom of a table (or in the text). While I suggest this approach, I also decided to use inline format in annotations because stacking everything vertically would take significant space of the table.
Alternatively, rotating headers by 90 degrees (requires rotating) might be an option but I haven't applied it here.

The example is based on tabularray (see the documentation). For more complex tables, it provides much easier interface to achieve more demanding formatting.

enter image description here

\documentclass[lettersize,journal]{IEEEtran}
% \usepackage{amsmath,amsfonts}
% \usepackage{algorithmic}
% \usepackage{algorithm}
% \usepackage{array}
% \usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}
% \usepackage{textcomp}
\usepackage{stfloats}
% \usepackage{url}
% \usepackage{verbatim}
% \usepackage{graphicx}
% \usepackage{cite}
\usepackage{xcolor}
\usepackage{tabularray} \UseTblrLibrary{booktabs}

\usepackage{kantlipsum} % Required only for dummy texts

\begin{document} \section{Introduction} \kant[1]

\begin{table}[b] \newcommand\hsep{\hspace{4em}} \centering \begin{talltblr}[ caption = {Experimental Value of Components}, label = {tab:Comparison}, ] { width=\textwidth, colspec = {@{} Q[3cm,m] X[c,m] {9}{X[c,m]} @{}}, row{1} = {c, font=\bfseries}, column{2} = {bg=black!20}, cell{1}{1-2} = {bg=black!10}, cell{Z}{1} = {c=11}{}, } \toprule Ref. & N (W) & VG & DCR & M. VS & T. VS & L. PIC & A & B & C & D \ \midrule Output Power, $P_{o}$ & 400 &&&&&&&&& \ Input-output voltage & 500 &&&&&&&&& \ Xyz xyz xyz & 600 &&&&&&&&& \ Xyz xyz xyz & 700 &&&&&&&&& \ Xyz xyz xyz & 800 &&&&&&&&& \ \bottomrule \parbox{\linewidth}{\linespread{1.21}\selectfont% \mbox{N: Number of ... (W)}\hsep \mbox{VG: Voltage Gain (G)}\hsep \mbox{DCR: Duty Cycle Range}\hsep \mbox{M.VS: Maximum Voltage Stress on ...}\hsep \mbox{T.VS: Total Voltage Stress on ...}\hsep \mbox{L.PIC: Low Pulsating Input Current}\hsep \mbox{A: Explanation for A}\hsep \mbox{B: Explanation for B}\hsep \mbox{C: Explanation for C}\hsep \mbox{D: Explanation for D}\hsep } \end{talltblr} \end{table*}

\kant[2-5] \end{document}

Celdor
  • 9,058