TeX - LaTeX Asked by celenius on August 17, 2021
Is there a way that I can insert a small space in a table?
When I use a superscript, the number touches the hline
.
documentclass[9pt,letterpaper]{article}
usepackage{helvet}
renewcommand{familydefault}{sfdefault}
begin{document}
begin{picture}(0,0)
put(20,-136){mbox{
footnotesize
begin{tabular}{ p{8em} r r l }
hline
& Total & Average & Unit
hline
Area1 & 419773 & 9.15 & emph{m$^2$}
Area2 & 0 & 0 & emph{m$^3$}
hline
end{tabular}
}}
end{picture}
end{document}
I tried inserting vspace
but this does not move everything, just one cell.
vspace{0.001 in} Area1 & vspace{0.001 in} 419773 & vspace{0.001 in} 9.15 & vspace{0.001 in} emph{m$^2$}
My preference would be to adjust this without an external package, as I am using an old version of LaTeX on a server that I cannot replace.
use
rule{0pt}{4ex}
in the first column of that line.
Correct answer by user2478 on August 17, 2021
you can load array
package then
setlengthextrarowheight{3pt}
the array package is a required part of the core latex distribution, so will be available on all installations.
Answered by David Carlisle on August 17, 2021
For a general reference on how to improve the spacing in tabular
and array
lines, see the article "Correct spacing for tables and arrays" by Claudio Beccari on p. 10 of TeX and TUG News 1993 (Vol. 2, No. 3).
His method, which involves judiciously inserting "struts", applies to lines in tabular
(as well as tabular*
, supertabular
, xtabular
, longtable
) and array
environments which contain
hline
,hline
, andhline
s) above or below them that might result in a cramped look of the output.He suggested defining a "top strut" and a "bottom strut" as follows:
newcommandT{rule{0pt}{2.6ex}} % Top strut
newcommandB{rule[-1.2ex]{0pt}{0pt}} % Bottom strut
Using your MWE as a starting point -- by the way, 9pt
is not a recognized option in the article
document class, so I'm omitting it -- one could put these macros to use as follows:
documentclass[letterpaper]{article}
usepackage{helvet}
renewcommand{familydefault}{sfdefault}
newcommandT{rule{0pt}{2.6ex}} % Top strut
newcommandB{rule[-1.2ex]{0pt}{0pt}} % Bottom strut
begin{document}
begin{tabular}{ p{8em} r r l }
hline
& Total & Average & Unit TB hline
Area 1 & 419773 & 9.15 & mtextsuperscript{2} T
Volume 1 & 0 & 0 & mtextsuperscript{3} B hline
end{tabular}
end{document}
Answered by Mico on August 17, 2021
The simplest solution was given by David Carlisle in How to add vertical space struts after hline?
hline
noalign{vskip 2mm}
For those who can use the bigstrut
package, then just inserting bigstrut[t]
will fix the problem.
documentclass[letterpaper]{article}
usepackage{helvet}
usepackage{bigstrut}
renewcommand{familydefault}{sfdefault}
begin{document}
begin{picture}(0,0)
put(20,-136){mbox{
footnotesize
begin{tabular}{ p{8em} r r l }
hline
& Total & Average & Unit
hline
Area1 & 419773 & 9.15 & emph{m$^2$} bigstrut[t]
Area2 & 0 & 0 & emph{m$^3$}
hline
end{tabular}
}}
end{picture}
end{document}
Answered by Scott Prahl on August 17, 2021
fwiw, http://www.tex.ac.uk/cgi-bin/texfaq2html?label=struttab summarises all the above, and mentions a couple of other packages. (apologies for intruding with an obvious pointer.)
Answered by wasteofspace on August 17, 2021
It may be worthwhile to take a look at the "booktabs" package, http://www.ctan.org/pkg/booktabs. Then, using e.g. the command midrule instead of hline provides additional space between the columns.
Answered by hrbjoern on August 17, 2021
use
addlinespace[2ex]
in the beginning of a line.
Of the booktabs package (which you want to use anyway to polish up your tables).
Answered by Johannes on August 17, 2021
rule{0pt}{4ex}}
x&x
;x&x
;x&x
Answered by adam on August 17, 2021
I found a cool solution for putting spaces inside a table. Simply add a row containing vspace{-0.3cm}. This will add a row to the table and then back up the spacing by 0.3cm or whatever you want.
Answered by Rick F on August 17, 2021
It’s easy to set rowsep
with tblr
environment of the new LaTeX3 package tabularray
:
documentclass[9pt,letterpaper]{article}
usepackage{helvet}
renewcommand{familydefault}{sfdefault}
usepackage{tabularray}
SetTblrInner{rowsep=2pt}
begin{document}
begin{picture}(0,0)
put(20,-136){mbox{
footnotesize
begin{tblr}{ p{8em} r r l }
hline
& Total & Average & Unit
hline
Area1 & 419773 & 9.15 & emph{m$^2$}
Area2 & 0 & 0 & emph{m$^3$}
hline
end{tblr}
}}
end{picture}
end{document}
Answered by L.J.R. on August 17, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP