0

enter image description hereI read all the contents but still have problem with diminishing the table width. tried all the solutions they do not work or most of them same results. This should not be closed. My code is different and t he solutions do not work!!!!

    \documentclass[review]{elsarticle}
    \begin{table}[H]
        \centering
        \caption{Printing parameters}
        \begin{tabular}{ccccccccc}
            & Layer height, mm & First layer speed, mm/s   &Printing speed, mm/s  & Extruder temperature, °C & Bed temperature, °C & Extrusion multiplier & Extrusion width, mm & Fan speed, \% \\ \hline
            Carbon fiber tow&  &  &  &  &  &  &  & 
        \end{tabular}
        \label{table3}
    \end{table}

\begin{table}[H] \centering \caption{Printing parameters} \begin{tabular}{ccccccccc} & Layer height, mm & First layer speed, mm/s &Printing speed, mm/s & Extruder temperature, °C & Bed temperature, °C & Extrusion multiplier & Extrusion width, mm & Fan speed, % \ \hline Carbon fiber tow& & & & & & & & \end{tabular} \label{table3} \end{table}

\begin{table}[H] \centering \caption{Printing parameters} \begin{tabular}{*{9}{c}} & Layer height, mm & First layer speed, mm/s &Printing speed, mm/s & Extruder temperature, °C & Bed temperature, °C & Extrusion multiplier & Extrusion width, mm & Fan speed, % \ \hline Carbon fiber tow& & & & & & & & \end{tabular} \label{table3} \end{table}

Zarko
  • 296,517
  • Welcome to TeX.SE! Please extend your code sniped to complete small document (MWE: Minimum Working Example), which reproduce your problem. If you like to preserve font size, than you need to reconsider table design (define cells for multiline contents). – Zarko Jan 15 '21 at 18:46
  • 1
    You could transpose the table – cgnieder Jan 15 '21 at 18:47
  • Transpose is not an answer actually – Ali abbasgun Jan 15 '21 at 18:48
  • 1
    @Aliabbasgun you should add that restriction to your question because it will work quite nicely for the example you posted ;) – cgnieder Jan 15 '21 at 18:49
  • 2
    The probably easiest way to save some space in this table is allowing linebreaks in the column headers. If this alone is going to make your table fit into the textwidth depends on the documentclass, font and margins sizes. – leandriis Jan 15 '21 at 18:49
  • cgnieder I think I told that I went with any solution I could. For this kind of table with one row rotation does not work – Ali abbasgun Jan 15 '21 at 18:53
  • 1
    You might also introduce variables for the parameters and explain those variables somewhere. Then you might just have $h_l/\si{\mm}$ & $v_l/\si{\mm\per\s}$ & ... (or similar) which would save a lot of space… – cgnieder Jan 15 '21 at 18:53
  • \documentclass[review]{elsarticle} – Ali abbasgun Jan 15 '21 at 18:53
  • Would you please check the code in your own latex to see that it does now work – Ali abbasgun Jan 15 '21 at 19:01
  • 1
    What exactly does "the solutions do not work" mean? Do you get error messages or just an output you don't like? In both cases, please show the code in which you tried one of the "not working solutions" and share why it does nor work for you. – leandriis Jan 15 '21 at 19:11
  • Yep. I tried to put the code here. The table is still wide. Not error. The table is wide. – Ali abbasgun Jan 15 '21 at 19:12
  • \begin{table}[H] \centering \caption{Printing parameters} \begin{tabular}{ccccccccc} & Layer height, mm & First layer speed, mm/s &Printing speed, mm/s & Extruder temperature, °C & Bed temperature, °C & Extrusion multiplier & Extrusion width, mm & Fan speed, % \ \hline Carbon fiber tow& & & & & & & & \end{tabular} \label{table3} \end{table} – Ali abbasgun Jan 15 '21 at 19:13
  • Tried all solutions here:https://tex.stackexchange.com/questions/332902/my-table-doesnt-fit-what-are-my-options – Ali abbasgun Jan 15 '21 at 19:15
  • 2
    Sure, I saw that your table currently is wider than the textwidth, but this does not answer my question. I can't see that you tried any of the suggestions presented in the answers to My table doesn't fit; what are my options? Did you already try the solution marked with "% Condense column headers via stacking"? This one should definitely work for your table. If you tried that and it did not work for you, please show the code of this attempt. – leandriis Jan 15 '21 at 19:15
  • 3
    @Aliabbasgun: Show the solution suggestions you tried and their associated output and why they don't work. Based on minimal evidence, many of them would work in your situation. – Werner Jan 15 '21 at 19:22
  • Yes I did it yesterday night! Thank you all:) – Ali abbasgun Jan 16 '21 at 10:37

1 Answers1

2

A combination of (a) allowing linebreaks in the header cells, (b) allowing hyphenation of longer words, (c) choosing a smaller-than-usual amount of whitespace padding between columns, (d) switching to \footnotesize, and (e) placing the units of measurement in a separate row gets the job done. Oh, and I would use the \si macro of the siunitx package to typeset the units of measurement.

enter image description here

\documentclass[review]{elsarticle}
\usepackage[T1]{fontenc}
\usepackage{setspace,tabularx,ragged2e,booktabs}
\newcolumntype{L}{>{\RaggedRight\hspace{0pt}}X} % allow hyphenation and linebreaking
\newcolumntype{C}{>{\Centering\hspace{0pt}}X}   % allow hyphenation and linebreaking
\usepackage[per-mode=symbol]{siunitx}           % for "\si" macro

\begin{document} \begin{table}[h!] \setstretch{1.0} \setlength\tabcolsep{2.5pt} % default is 6pt \footnotesize % to match font size size of caption \caption{Printing parameters} \label{table3}

\medskip \begin{tabularx}{\textwidth}{@{} L *{8}{C} @{}} \toprule & Layer height & First layer speed & Printing speed & Extruder temperature & Bed temperature & Extrusion multiplier & Extrusion width & Fan speed \ & [\si{\milli\meter}] & [\si{\milli\meter\per\second}] & [\si{\milli\meter\per\second}] & [\si{\celsius}] & [\si{\celsius}] & & [\si{\milli\meter}] & [%] \ \midrule Carbon fiber tow & & & & & & & & \ \addlinespace Something else & & & & & & & & \ \bottomrule \end{tabularx} \end{table} \end{document}

Mico
  • 506,678
  • 2
    For reference, all of the suggestions here (except for increased hyphenation via ragged2e is covered in the suggested duplicate. – Werner Jan 15 '21 at 23:08
  • @Werner - I suspect the OP somehow didn't understand that the various adjustments can be combined, if needed. – Mico Jan 15 '21 at 23:16