3

I am preparing a document with a quite special format: the first row in a long table should be written with \scriptsize font:

\documentclass{article}
\usepackage{longtable}
\usepackage{array}

\begin{document}

 \begin{longtable}{|>{\centering\arraybackslash}m{2em}|>{
 \centering\arraybackslash}m{2em}|>{\centering\arraybackslash}m{2em}|>{
 \centering\arraybackslash}m{2em}|>{\centering\arraybackslash}m{2em}|}
 \hline   
 {\bf\scriptsize 1} & {\bf\scriptsize 2} &
 {\bf\scriptsize 3} & {\bf\scriptsize 4} &
 {\bf\scriptsize 5}
 \\  \hline 
 \endfirsthead
  1 & 2 & 3 & 4 & 5\\
 \hline
 1 & 2 & 3 & 4 & 5\\
 \hline
 1 & 2 & 3 & 4 & 5\\
 \hline
 \end{longtable}

\end{document} 

I would like to reduce height of the first row. The lower vertical space can be reduced by replacing \\ with \\[-0.3em] after the first row. But what to do with the upper space? I would be appreciate for any useful suggestions.

2 Answers 2

2

If there were no vertical rules you could do

\hline
\noalign{\vskip-3pt}

(and unrelated, but use \bfseries\scriptpsize 3 & not {\bf\scriptsize 3} & )


But as there are you could do:

enter image description here

\documentclass{article}
\usepackage{longtable}
\usepackage{array}

\begin{document}

\def\mystrut{\vrule height 8pt depth 2pt width 0pt\kern4\arrayrulewidth}
 \begin{longtable}{|>{\centering\arraybackslash}m{2em}|>{
 \centering\arraybackslash}m{2em}|>{\centering\arraybackslash}m{2em}|>{
 \centering\arraybackslash}m{2em}|>{\centering\arraybackslash}m{2em}|}
 \hline   
\omit\vrule \scriptsize\bfseries\mystrut\hfill 1 \hfill\vrule&
\omit       \scriptsize\bfseries\mystrut\hfill 2 \hfill\vrule&
\omit       \scriptsize\bfseries\mystrut\hfill 3 \hfill\vrule&
\omit       \scriptsize\bfseries\mystrut\hfill 4 \hfill\vrule&
\omit       \scriptsize\bfseries\mystrut\hfill 5 \hfill\vrule\\
  \hline 
 \endfirsthead
  1 & 2 & 3 & 4 & 5\\
 \hline
 1 & 2 & 3 & 4 & 5\\
 \hline
 1 & 2 & 3 & 4 & 5\\
 \hline
 \end{longtable}

\end{document} 
4
  • Thank you. The problem is that this reduces the upper space but also results in vertical lines above the table. How to remove them?
    – Andrew
    Oct 5, 2012 at 13:03
  • 1
    @Andrew Avoid vertical rules: they are evil. ;-)
    – egreg
    Oct 5, 2012 at 13:11
  • These vertical lines are more than evil: they are suggested by some bureaucratic rules:)
    – Andrew
    Oct 5, 2012 at 13:18
  • Thank you very much. It works. Now I will try to apply it for my document.
    – Andrew
    Oct 5, 2012 at 13:35
-1

Use \vspace(-0.3in) with a negative value.

2
  • 4
    Welcome to TeX.SX! Please elaborate on this (and use correct syntax please). Where should the OP put it f.i.?
    – TeXnician
    May 27, 2017 at 18:15
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. A suggestion: Do us a favour and change your username to something more telling than "user1234". May 27, 2017 at 23:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .