Additional space cells in tables with equations

Additional space cells in tables with equations



I try with some recommendations to add vertical space for cells with equations, and I couldn't achieve it.



Here is my MWE:


documentclass[12pt,a4paper]article
usepackagearray
usepackagemakecell
renewcommandtheadfontnormalsizebfseries
usepackage[math]cellspace
setlengthcellspacetoplimit4pt
setlengthcellspacebottomlimit4pt

usepackagecolor,colortbl,hhline
definecolorGraygray0.9
usepackagecaption
usepackageamsmath

begindocument
begintable[htpb]
centering
captionSolución de la ecuación
begintabular
hline
rowcolorGray theadCaso & theadSolución \
hline
$zeta = 1$ & $u(t) = [u(0) + (dot u(0) + u(0) omega_n )t]e^-omega_n t$\hline
$zeta > 1$ & $u(t) = dfrace^-omega_nzeta2omega_nsqrtzeta^2-1leftlbraceleft[omega_n(zeta+sqrtzeta^2-1)u(0)+dot u(0)right]e^omega_nsqrtzeta^2-1-big[omega_n(zeta - sqrtzeta^2-1)u(0)+dot u(0)big]e^-omega_nsqrtzeta^2-1rightrbrace$ \hline
$zeta < 1$ & $u(t) = e^-omega_nzeta tleft[u(0)cosomega_Dt + left(dfracdot u(0) + omega_nzeta u(0)omega_Dright)right]$ \hline
endtabular
endtable
enddocument



Update



Maybe I can't anchieve the solution because of conflicts between some packages. This is my preamble, and the Typeset Engine is pdfLaTeX:


pdfLaTeX


documentclass[12pt,a4paper]article

%usepackagepolyglossia
%setdefaultlanguage[babelshorthands]spanish
%usepackage[Ligatures=TeX]fontspec
usepackage[spanish,es-noshorthands]babel
usepackage[T1]fontenc%http://tex.stackexchange.com/questions/44694/fontenc-vs-inputenc
usepackage[utf8]inputenc
usepackagemathptmx%http://tex.stackexchange.com/questions/669/how-do-i-make-my-document-use-the-times-font-both-for-the-text-and-the-math
%fontspecTimes New Roman
%usepackagefontspec
%setmainfontTimes New Roman
%usepackage[T1]fontenc
%usepackageifthen
%usepackagefontspec
%setmainfontArial

usepackage[table]xcolor

%usepackage[htt]hyphenat
%
%usepackagepdflscape

%usepackage[title]appendix

usepackage[style=apa]biblatex
addbibresourcebibltarea6.bib

%usepackagearray,multirow
usepackagemakecell
renewcommandtheadfontnormalsizebfseries
renewcommandtheadgape
usepackage[math]cellspace
setlengthcellspacetoplimit4pt
setlengthcellspacebottomlimit4pt

usepackagelistings
lstset
basicstyle = ttfamily,
keywordstyle= colorbluetextbf,
commentstyle= colorgray,
stringstyle= colorgreen!70!black,
stringstyle= colorred,
columns= fullflexible,
numbers= left,
numberstyle= scriptsizesffamilycolorgray,
xleftmargin= 0.07textwidth,
xrightmargin= 0.05textwidth,
showstringspaces = false,


%usepackageinconsolata

%newcommandCppCtexttt++
%renewcommandlstlistingnameCódigo
%renewcommandlstlistlistingnameÍndice de códigos

%usepackagetikz
%usepgflibraryarrows.meta
%tikzset%
% newTip/.tip=Bar[sep=-1.45pt, width=10pt] Circle[sep=-1.25pt,width=2.5pt,length=2.5pt]
%
%usetikzlibrarypatterns
%
%usepackagetikz
%usepgflibraryarrows.meta,shapes.arrows
%tikzset%
% newTip/.tip=Bar[sep=-1.45pt, width=10pt] Circle[sep=-1.25pt,width=2.5pt,length=2.5pt]
%
%usetikzlibrarypatterns
%usetikzlibrarycalc

%usepackagecaption
%usepackagesubcaption

usepackageamsmath
usepackagemathtools
%setcounterMaxMatrixCols25

usepackagesiunitx
sisetupper-mode = symbol

%usepackagepgfplots

%newcountermyrow

%usepackagelongtable
%usepackagethreeparttable

%usepackage[inline]enumitem
%usepackagehyperref

usepackagetitlesec
titleformat*sectionbfseriesnormalsize
titleformat*subsectionbfseriesnormalsize
titleformat*subsubsectionbfseriesnormalsize

usepackage[ampersand]easylist

%usepackagelayout

usepackagecolor,colortbl,hhline
definecolorGraygray0.9

%usepackage[a4paper,left=3cm, top=3cm, right=2.5cm, bottom=2.5cm]geometry

setlengthhoffset.46cm
setlengthoddsidemargin13.08pt
setlengthevensidemargin0cm
setlengthmarginparwidth0cm
setlengthtopmargin-7mm
setlengthmarginparsep0cm
setlengthheadheight8mm
setlengthheadsep4.6mm
setlengthtextheight24cm
setlengthfootskip8mm
setlengthtextwidth15.5cm

usepackagefancyhdr
pagestylefancy
lheadfootnotesizePontificia Universidad Católica del Perú\ footnotesizeEscuela de Posgrado - Ingeniería Civil%Significa que est
chead%Vac
rheadfootnotesizeDinámica de Estructuras\ Tarea 1
lfootfootnotesize%Pie izquierdo
cfootthepage
rfootfootnotesizeFernández Yopla, Isai

renewcommandheadrulewidth0.4pt%Falta investigar
renewcommandfootrulewidth0.4pt

usepackage[pass]geometry%pass tells output driver which paper size use.




2 Answers
2



equation in the second row/column is far to long. you need to split it in two lines. for example with use the aligned environment from the package mathtools. for more vertical space you should used S column specifier from cellspace. for example for the second column: Sp12cm:


aligned


mathtools


S


cellspace


Sp12cm



edit:


siunitx


S


cellspace


C


Cp(12cm)


geometry






documentclass[12pt,a4paper]article
usepackage[T1]fontenc%http://tex.stackexchange.com/questions/44694/fontenc-vs-inputenc
usepackage[utf8]inputenc
usepackage[spanish,es-noshorthands]babel
usepackagemathptmx%http://tex.stackexchange.com/questions/669/how-do-i-make-my-document-use-the-times-font-both-for-the-text-and-the-math

usepackagemakecell,hhline % <---
renewcommandtheadfontnormalsizebfseries
renewcommandtheadgape
usepackagecellspace % <---
setlengthcellspacetoplimit4pt
setlengthcellspacebottomlimit4pt

usepackagemathtools % it load "amsmath" too
usepackagesiunitx % <--- used it, the "S" from the "cellspace# package
% had to be replaced with "C"
usepackage[table]xcolor % <---
definecolorGraygray0.9
usepackagegeometry % for simple determination of page layout.
% see its documentation!

begindocument
begintable[htpb]
centering
captionSolución de la ecuación
begintabular
hline
rowcolorGray
theadCaso & theadSolución \
hline
$zeta = 1$ & $u(t) = bigl[u(0) + bigl(dotu(0) + u(0) omega_nbigr) tbigr] e^-omega_n t$ \ hline
$zeta > 1$ & $beginmultlined
u(t) = dfrace^-omega_nzeta2omega_nsqrtzeta^2-1
bigglBigl[omega_nBigl(zeta+sqrtzeta^2-1Bigr)u(0)+dotu(0)Bigr] e^omega_nsqrtzeta^2-1 - \
Bigl[omega_nBigl(zeta - sqrtzeta^2-1Bigr)u(0)+dotu(0)Bigr] e^-omega_nsqrtzeta^2-1
biggr
endmultlined$ \ hline
$zeta < 1$ & $u(t) = e^-omega_nzeta t
biggl[u(0)cosomega_Dt +
biggl(dfracdotu(0) + omega_nzeta u(0)omega_Dbiggr)
biggr]$ \ hline
endtabular
endtable
enddocument



enter image description here





I think that I have some packages in conflict, because I don't have the results, and S doesn't work: "./T1Dyn18.Isai.tex:299: Package array Error: Illegal pream-token (p12cm): `c' used."
– Isai
Sep 1 at 7:10



S





I have been working with pdfLaTeX.
– Isai
Sep 1 at 7:15


pdfLaTeX





ups, at editing table code i overwrite last three lines of mwe code. sorry. now corrected. i consider all packages in mwe in your question and compile mwe with pdfLaTeX. apparently you tested table code in document with different preamble. solution, as it is now, works (tested again).
– Zarko
Sep 1 at 7:24





I have updated the question with my preamble, I would like you to help me to fix this.
– Isai
Sep 1 at 7:33





@Isai, as i suspect, your real preamble is different. problem cause use of the siunitx package. when you use it, than S from cellspace had to be replaced by C. i will edit my answer asap.
– Zarko
Sep 1 at 7:35



siunitx


S


cellspace


C



As @Zarko has already pointed out in his answer, the main problem is that one of the main equations is far too long to fit in a single row. Use an aligned environment to introduce a suitably chosen line break.


aligned



Once you've line-broken the long equation, there's no need to use p column types; instead, just use the basic l column type for both columns.


p


l



In order to declutter the tabular material some more, I would remove the repetitive u(t) = parts from the cells and, instead, stick that information into the table's caption.


u(t) =



I would also like to suggest that you give the table a much more open "look", mainly by getting rid of all vertical and horizontal black lines -- they're simply not needed. I'd also load the booktabs package and use its addlinespace macro to further increase whitespace between rows.


booktabs


addlinespace



In addition, I would replace all left and right directives with explicit sizing instructions.


left


right



enter image description here


documentclass[12pt,a4paper]article
usepackage[spanish]babel % new
usepackagearray
usepackagebooktabs % for "addlinespace" macro
usepackage[table]xcolor
definecolorGraygray0.9
usepackage[skip=0.333baselineskip]caption
usepackageamsmath % for 'aligned' environment

begindocument
begintable[htpb]
setlengthextrarowheight3pt
centering
captionSolución de la ecuación por $u(t)$
begintabularll
rowcolorGray textbfCaso & textbfSolución \
addlinespace
$zeta = 1$ &
$displaystyle
bigl[u(0) + (dot u(0) + u(0) omega_n )tbigr]
e^-omega_n t
$\ addlinespace
$zeta > 1$ &
$beginaligned[t]
frace^-omega_nzeta2omega_nsqrtzeta^2-1Bigllbrace
&bigr[omega_n(zeta+sqrtzeta^2-1)u(0)+dot u(0)bigr]
e^omega_nsqrtzeta^2-1\
-&bigl[omega_n(zeta - sqrtzeta^2-1)u(0)+dot u(0)bigr]
e^-omega_nsqrtzeta^2-1,
Bigrrbrace
endaligned$ \ addlinespace
$zeta < 1$ &
$displaystyle
e^-omega_nzeta tbigl[u(0)cosomega_Dt
+ bigl(dot u(0) + omega_nzeta u(0)bigr)big/omega_D
bigr]$ \
endtabular
endtable
enddocument





Thank you very much. But I have to work with siunitx, and this is the problem: . ! File ended while scanning use of __siunitx_tmp:w
– Isai
Sep 1 at 8:25


siunitx


. ! File ended while scanning use of __siunitx_tmp:w





@Isai - Please see the revised code I just posted. It no longer uses the machinery of the cellspace and makespace packages and hence, by construction, doesn't interfere with anything the siunitx package does.
– Mico
Sep 1 at 8:27


cellspace


makespace


siunitx





Thanks for your intention, I think that the software has problems because I have the same problem with siunitx, but when I don't use it, everything is right. I have Texpad software.
– Isai
Sep 1 at 15:48


siunitx





Done! I had to update the packages.
– Isai
Sep 1 at 16:03



Thanks for contributing an answer to TeX - LaTeX Stack Exchange!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)