# \usepackage{parskip} and \tabular

As I had issue with line breaks, How should I do manual line breaks?, I used \usepackage{parskip}.

This worked fine.

But, when I have a tabular environment, there is a lot of vertical spacing before and after the enviroment.

Code:

\documentclass{article}
\usepackage{tabto}
\usepackage{parskip}

\newcommand{\inlinecode}[1]{\texttt{\small\color{blue}{#1}}}
\newcommand{\n}[0]{\\[3mm]}

\begin{document}

This is a line.

This a new paragraph.

\subsubsection{Closing Windows}
\begin{flushright}
\begin{tabular}{p{10mm}p{40mm}p{80mm}}
1 & dskhkdfahsk & khskdahfkhk\n
2 & two & three\n
\end{tabular}
\end{flushright}

Hello1

Hello2

\end{document}


Is there any way I can disable parskip for tabular alone?

-
Don't use this flushright-environment. Like center it will add additional space. And please stop to sent code snippets. That's quite impolite as it makes helping more difficult - even more if this code snippets use nonstandard commands and so can't be compile with a standard preamble without errors. –  Ulrike Fischer Feb 7 '13 at 9:44
Just use {\raggedleft\begin{tabular}...\end{tabular}\par} –  egreg Feb 7 '13 at 12:59
@egreg Thanks, that works... –  ATOzTOA Feb 7 '13 at 13:31

The main problem with your example comes from the width of the tabular. For illustration consider the following sequence of flushright environments:

\documentclass{article}

\begin{document}
\begin{flushright}
\rule{2cm}{0.4pt}
\end{flushright}
\begin{flushright}
\rule{5cm}{0.4pt}
\end{flushright}
\begin{flushright}
\rule{10cm}{0.4pt}
\end{flushright}
\begin{flushright}
\rule{15cm}{0.4pt}
\end{flushright}
\begin{flushright}
\rule{2cm}{0.4pt}
\end{flushright}
\end{document}


producing

You'll see that there is extra vertical space before the line that is wider than text width.

In your example, the tabular has width 130mm plus the intercolumn spacing and the log file tells you that the line is overfull by 60.8858pt. Reducing the dimension of say the last column, the anomolous spacing disappears:

\documentclass{article}
\usepackage{tabto}
\usepackage{parskip}

\newcommand{\inlinecode}[1]{\texttt{\small\color{blue}{#1}}}
\newcommand{\n}[0]{\\[3mm]}

\begin{document}

This is a line.

This a new paragraph.

\subsubsection{Closing Windows}

\begin{flushright}
\begin{tabular}{p{10mm}p{40mm}p{30mm}}
1 & dskhkdfahsk & khskdahfkhk\n
2 & two & three\n
\end{tabular}
\end{flushright}

Hello1

Hello2

\end{document}


flushright adds some extra vertical spacing (\topsep, standard value 8pt plus 2pt minus 4t, but set to 0pt by the parskip package), but this on its own is not as dramitic as what you were seeing, unless the contents are overwide.

flushright acts like this because it is defined as

\trivlist \raggedleft\item\relax


which creates something akin to

\hfill\strut\hskip 0pt


on the first line. LaTeX then finds an allowable break point at the \hskip, and when the line is overfull, can choose to break there.

-

I found a solution.

I used this:

\setlength{\parskip}{\dimexpr\baselineskip plus 1pt minus 20pt\relax}


After a lot of experimentation with the plus and minus values, I got it working.

-
I don't think this is a solution. Try this: \documentclass{article} \setlength{\parskip}{1\baselineskip plus 1pt minus 20pt} \def\test{abc\par} \def\testa{\test\test\test\test\test} \def\testb{\testa\testa\testa\testa\testa} \def\testc{\testb\testb} \begin{document} \testc \end{document} –  egreg Feb 7 '13 at 9:37
@egreg Thanks a lot... –  ATOzTOA Feb 7 '13 at 10:33