Why does longtable not process \medskip inside a row, but tabular does?
longtable inserts a strut at the begin of p-cell. This means that TeX is no longer in vertical mode and so the \medskip
has a different effect. If one remove this strut the output is identical (but it could have side effects ...):
Edit
The Issue has been reported (https://www.latex-project.org/cgi-bin/ltxbugs2html.new?pr=tools/3785). So the solution is known, the main question is how to add to longtable without breaking existing documents ...
\documentclass[]{article}
\usepackage{longtable}
\begin{document}
\LTleft=\parindent
\begin{tabular}{p{3in}}\hline
\relax\ifvmode yes \else no \fi %\medskip
xxxx
\medskip
\\\hline
\end{tabular}
\begin{longtable}{p{3in}}\hline
\relax\ifvmode yes \else no \fi %\medskip
xxxx
\medskip
\\\hline
\end{longtable}
\begin{tabular}{p{3in}}\hline
\medskip
xxxx
\medskip
\\\hline
\end{tabular}
\makeatletter
\def\LT@startpbox#1{%
\bgroup
\let\@footnotetext\LT@p@ftntext
\setlength\hsize{#1}%
\@arrayparboxrestore
%\vrule \@height \ht\@arstrutbox \@width 1pt
}
\makeatother
\begin{longtable}{p{3in}}\hline
\medskip
xxxx
\medskip
\\\hline
\end{longtable}
\end{document}
As Ulrike pointed out, the difference is due to a difference in strut handling.
You are using array
package
In general longtable
follows array
usage, it documents
% The rest of this macro is mainly based on \package{array} package, but
% should work for the standard \env{tabular} too.
However there was a more recent change to array
that is not reflected in longtable
% \changes{v2.1c}{1992/12/14}{Use `everypar to insert strut}
% \begin{macrocode}
\everypar{%
\vrule \@height \ht\@arstrutbox \@width \z@
\everypar{}}%
}
% \end{macrocode}
However longtable
uses the pre 1992 version
\vrule \@height \ht\@arstrutbox \@width \z@}
You would think the authors of the array
and longtable
packages might have communicated with each other during the last 25 years but apparently not.
You can use \vadjust pre
\documentclass[]{article}
\usepackage{amsmath}
\usepackage{array}
\renewcommand{\arraystretch}{1.25}
\usepackage{longtable}
\begin{document}
\begin{center}
\begin{tabular}{|l|l|m{3in}|}\hline
Left & right & eigenvalues and corresponding eigenfunction\\\hline
$y(0) = 0$ & $y(L) = 0$ &
\medskip
\begin{tabular}{|l|l||l|}\hline
$\lambda<0$ & None & None\\\hline
$\lambda=0$ & None & None\\\hline
$\lambda>0$ & $(\frac{n\pi}{L})^{2}\qquad n=1,2,3,\dotsc$ &
$\sin(\frac{n\pi}{L}x)$\\\hline
\end{tabular}\medskip
\\\hline
\end{tabular}
\end{center}
\begin{longtable}{|l|l|m{3in}|}\hline
Left & right & eigenvalues and corresponding eigenfunction\\\hline
$y(0) = 0$ & $y(L) = 0$ &
\vadjust pre{\vspace{\medskipamount}}%
\begin{tabular}{|l|l||l|}\hline
$\lambda<0$ & None & None\\\hline
$\lambda=0$ & None & None\\\hline
$\lambda>0$ & $(\frac{n\pi}{L})^{2}\qquad n=1,2,3,\dotsc$ &
$\sin(\frac{n\pi}{L}x)$\\\hline
\end{tabular}\vspace{\medskipamount}
\\\hline
\end{longtable}
\end{document}
Please, note also the proper input (no \left
and \right
; \dotsc
instead of \cdots
). The [c]
option is different for longtable
and tabular
(but is the default for both).