The following does what is wanted, for tabular
s. It uses the fact that tabular line spacing is determined by \strutbox
whose height and depth in the memoir
class are defined to be respectively .7
and .3
of the current \baselineskip
.
Actually, this is the same as in the article
class. Anyhow using \strutbox
in the code is better, so I updated accordingly the answer. And the code now also takes into account \arraystretch
(changes to \arraystretch
should happen before the \MySpacing
environment).
The included output has examples on two columns.
Last edit: new version of the helper macro \AfterMySpacing
, which deals better with a page break occuring exactly after the end of the \MySpacing
environment.
Added explanations: this document (with memoir
class) starts in \OnehalfSpacing
mode (this is a macro of memoir
which enlarges the \baselineskip
by a value depending on the type size, for 10pt
the factor is 1.25
). Then the column on the right switches to \DoubleSpacing
(this does not mean that the interline spacing is doubled, the ratio is rather 1.667
for 10pt
size).
The boxed values are the parameters given to the \MySpacing
environment. This parameter tells the environment which multiple of the standard baselineskip (whose value is set up by the class depending on the font size option passed to it) to use for interline spacing in the tabular environment (recall that tabular
s add \struts
to ensure regular line spacing -- a safeguard which fails if a cell contents has a height or depth larger than the used strut). This multiplier is applied to the default \baselineskip
, not to the one used in the surrounding paragraph already stretched out either by \OnehalfSpacing
or \DoubleSpacing
.
Finally, there is a LaTeX
parameter called \arraystretch
, normally set to 1
, which multiplies the interline-spacing of all tabulars and arrays. The environment \MySpacing
was written to take it into account. So the examples end with a test of this by setting the \arraystretch
to 2
but using parameter .5
so that the net effect is like using \MySpacing
with parameter 1
.
Note 1: with the parameter given to \MySpacing
set to only .75
, the strut used in the tabular has (with the default fonts) its height a tiny bit smaller than the height of the letter X
(circa half a point smaller), hence the line spacing is not exactly as intended (and can be irregular inside the tabular, depending on its content), although this is not so visible to the naked eye. But this problem goes away for parameter values higher than .82
.
Note 2: if the environment \MySpacing
contains, rather than a tabular, text in lines (ending with \\
except the last one), the wished-for spacing with respect to the surrounding lines will be obtained by inserting a \strut
in both the first and the last lines of the enclosed block. (assuming \arraystretch
equal to 1
).
\documentclass{memoir}
\usepackage{multicol}
\OnehalfSpacing
\raggedbottom
\makeatletter
% helper macro for the environment MySpacing
% initial version:
%\newcommand{\AfterMySpacing}{\noindent
% \vphantom{\vrule height \baselineskip depth \z@}}
% new method, better if pagebreak occurs right after the MySpacing block
\newcommand{\AfterMySpacing}{%
\vskip\dp\strutbox
\prevdepth\dp\strutbox
\noindent\strut} % <- the \strut here could be removed, TeX adds the
% necessary vertical skip.
% And, actually, perhaps the macro would be more flexible
% also with the ending \noindent removed.
\newenvironment{MySpacing}[1]
{\par\nointerlineskip
\vskip\baselineskip
\def\baselinestretch{#1}\@currsize
\vskip-\arraystretch\ht\strutbox\relax % replaces \vskip-.7\baselineskip
}
{\par\nointerlineskip
\vskip-\arraystretch\dp\strutbox\relax % replaces \vskip-.3\baselineskip
\ignorespacesafterend\aftergroup\AfterMySpacing}
\makeatother
\begin{document}
\begin{multicols}{2}
\fbox{2} Before the block Before the block Before the block\dots
\begin{MySpacing}{2}
\hspace*{1cm}%
\begin{tabular}{ll}
ooo & xxx \\
baz & qux \\
foo & pqr \\
\end{tabular}
\end{MySpacing}
\ldots{} after the block after the block after the block after the block
after the block
\fbox{1} Before the block Before the block Before the block\dots
\begin{MySpacing}{1}
\hspace*{1cm}%
\begin{tabular}{ll}
ooo & XXX \\
baz & qux \\
foo & abc \\
\end{tabular}
\end{MySpacing}
\ldots{} after the block after the block after the block after the block
after the block
\fbox{.75} Before the block Before the block Before the block\dots
\begin{MySpacing}{.75}
\hspace*{1cm}%
\begin{tabular}{ll}
ooo & XXX \\
baz & qux \\
foo & pqr \\
\end{tabular}
\end{MySpacing}
\ldots{} after the block after the block after the block after the block
after the block
\columnbreak
\DoubleSpacing
\verb|\DoubleSpacing|
\fbox{2} Before the block Before the block Before the block\dots
\begin{MySpacing}{2}
\hspace*{1cm}%
\begin{tabular}{ll}
ooo & XXX \\
baz & qux \\
foo & pqr \\
\end{tabular}
\end{MySpacing}
\ldots{} after the block after the block after the block after the block
after the block
\renewcommand{\arraystretch}{2}
\verb|\renewcommand{\arraystretch}{2}|
% for testing purposes
\fbox{.5} Before the block Before the block Before the block\dots
\begin{MySpacing}{.5}
\hspace*{1cm}%
\begin{tabular}{ll}
ooo & XXX \\
baz & qux \\
foo & pqr \\
\end{tabular}
\end{MySpacing}
\ldots{} after the block after the block after the block after the block
after the block
\end{multicols}
\end{document}
You're using different baselineskips and you don't take care of this aspect.
\documentclass{memoir}
\newlength{\tightlisttopsep}
\AtBeginDocument{
\setlength{\tightlisttopsep}{-\baselineskip}
\addtolength{\tightlisttopsep}{\fontchardp\font`j}% a descender
\addtolength{\tightlisttopsep}{.15pt} % some overshoot
\OnehalfSpacing
\addtolength{\tightlisttopsep}{.7\baselineskip}% height of strut
% Show the baselines
\edef\myrule{\noexpand\smash{\vrule depth\the\baselineskip\kern-.4pt}}
}
\newenvironment{mytightlist}[3]{%
% noticeably tighter than the memoir class's tightlist facilities
\begin{Spacing}{1}%
\begin{list}{#1}{%
\setlength{\topsep}{\tightlisttopsep}%
\setlength{\parskip}{0pt}%
\setlength{\parsep}{0pt}%
\setlength{\itemsep}{0pt}%
\setlength{\leftmargin}{#2}%
\setlength{\labelwidth}{#3}%
\setlength{\labelsep}{0.5em}%
}%
}%
{\end{list}\end{Spacing}}
\begin{document}
1. HHHHHHHHH\myrule H
2. HHHHHHHHHH\myrule
\begin{mytightlist}{\(\bullet\)}{1.5em}{0.5em}
\item 3. HHHHHHHHHH
\item 4. \myrule HHHHHHHHHH
\end{mytightlist}
5. HHHHHHHHHH
6. HHHHHHHHHH
\end{document}
This is without hope if the mytightlist
is used when a different font size is in force, because the settings are made just for the standard size.
The result is surely poor typography, in my opinion.
Best Answer
What the package is doing is splitting each column up line by line and then re-assembling the page a line at a time constructing each line out of the lines from the columns, so the final result is even line spacing and the line spacing in the original column settings is necessarily lost
If you don't do that then you have to work a lot harder if you want to allow page breaks at arbitrary points mid-paragraph as if the columns have different line spacing there may not be any feasible break points in general.
So while it is possible to devise a parallel markup system that allows different spacing, probably
parcolumns
should not be your starting point for that as you would have to change almost the entire package.It seems that the OP wants columns of different sizes. It seems that the
paracol
package supports that so long as you don't try to be too tricky with floating environments (which would need to be restricted to columns of the same width)