# Control vertical space between answers in alterqcm

Consider the following minimal example of the alterqcm package:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}
\usepackage{alterqcm}

\parindent0pt
\begin{document}
\begin{alterqcm}[lq=8cm,language=english]
\AQquestion{Question}{%
{Proposition 1},
{Proposition 2},
{Proposition 3}}
\end{alterqcm}

\end{document}

Is there any option such that the spacing between Proposition 1, Proposition 2 and Proposition 3 is more compact like in a compactenum environment (using the paralist package)?

Is there any way to have globally fine control over this vertical spacing?

Edit:

I tried Werner's answer, however if I want to make the spaces smaller, it seems to have only minimal effect:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}
\usepackage{alterqcm}

\setlength{\parindent}{0pt}
\begin{document}

\begin{alterqcm}[lq=8cm,language=english]
\AQquestion{Question}{%
{Proposition 1},
{Proposition 2},
{Proposition 3}}
\end{alterqcm}

\bigskip

% =========== FACTOR approach ===========
{\renewcommand{\arraystretch}{0.1}
\begin{alterqcm}[lq=8cm,language=english]
\AQquestion{Question}{%
{Proposition 1},
{Proposition 2},
{Proposition 3}}
\end{alterqcm}}

\bigskip

% =========== LENGTH approach ===========
{\setlength{\extrarowheight}{-10mm}%
\begin{alterqcm}[lq=8cm,language=english]
\AQquestion{Question}{%
{Proposition 1},
{Proposition 2},
{Proposition 3}}
\end{alterqcm}}

\end{document}

Gives:

-
Up to now there are only answers that let me enlarge the space between the propositions. Any idea how to make it smaller? –  student Dec 30 '11 at 10:18
Try with \renewcommand{\arraystretch}{0.8} because 0.1 is not possible. You divide by 10 the height of the line !! Is not a very good idea to modify the line like this. It wiil be interesting to see your example with some fractions . –  Alain Matthes Jan 2 '12 at 17:15
If the array is to long you have only two solutions : you use a smaller font with \small I prefer this solution and you can use arraystretch but the result is not very fine. –  Alain Matthes Jan 2 '12 at 17:48

Each of the entries of #3 supplied to \AQquestion[#1]{#2}{#3} are processed and stored in a vertical box (\vbox). If you want, you could \smash the contents to remove any vertical padding. This can either be done manually (on a per-item basis), or globally by means of a patch provided by etoolbox.

\documentclass[12pt]{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\usepackage[utf8]{inputenc}% http://ctan.org/pkg/inputenc
\usepackage[upright]{fourier}% http://ctan.org/pkg/fourier
\usepackage{alterqcm}% http://ctan.org/pkg/alterqcm

\setlength{\parindent}{0pt}
\begin{document}

% Original display
\begin{alterqcm}[lq=8cm,language=english]
\AQquestion{Question}{%
{Proposition 1},
{Proposition 2},
{Proposition 3}}
\end{alterqcm}

\bigskip

% Smashed display
{\begin{alterqcm}[lq=8cm,language=english]
\AQquestion{Question}{%
{\smash{Proposition 1}},
{\smash{Proposition 2}},
{\smash{Proposition 3}}}
\end{alterqcm}}

\bigskip

% Global smashed display
\makeatletter
\patchcmd{\aq@prop}{\vbox{#1}}{\vbox{\smash{#1}}}{}{}% patch \aq@prop
\makeatother
\begin{alterqcm}[lq=8cm,language=english]
\AQquestion{Question}{%
{Proposition 1},
{Proposition 2},
{Proposition 3}}
\end{alterqcm}

\end{document}

However, this global change might yield unwanted results if your constructions are higher/lower than a regular line (as in Altermundus' answer). You can localize the change to a specific instance of \AQquestion by grouping it:

\begingroup
\makeatletter
\patchcmd{\aq@prop}{\vbox{#1}}{\vbox{\smash{#1}}}{}{}% patch \aq@prop
\makeatother
\begin{alterqcm}
%...
\end{alterqcm}
\endgroup

Or you could make local changes using \smash, but stretch each component to your liking using an invisible vertical rule:

\begin{alterqcm}[lq=8cm,language=english]
\AQquestion{Question}{%
{\smash{Proposition 1}},
{\rule{0pt}{20pt}\smash{Proposition 2}},% Invisible vertical rule with height 20pt
{\smash{Proposition 3}}}
\end{alterqcm}

Due to the issue of a bounty on this question and the rules regarding bounty awarding, I've posted a new answer rather than modify my existing answer.

-
Great, thanks a lot! –  student Jan 3 '12 at 11:14

Since the typesetting of the alterqcm environment is done in a tabular, you can perform the same adjustments you normally would for gaining extra row height. Here's a minimal example:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}
\usepackage{alterqcm}

\setlength{\parindent}{0pt}
\begin{document}
\begin{alterqcm}[lq=8cm,language=english]
\AQquestion{Question}{%
{Proposition 1},
{Proposition 2},
{Proposition 3}}
\end{alterqcm}

\bigskip

% =========== FACTOR approach ===========
{\renewcommand{\arraystretch}{2}
\begin{alterqcm}[lq=8cm,language=english]
\AQquestion{Question}{%
{Proposition 1},
{Proposition 2},
{Proposition 3}}
\end{alterqcm}}

\bigskip

% =========== LENGTH approach ===========
{\setlength{\extrarowheight}{20pt}%
\begin{alterqcm}[lq=8cm,language=english]
\AQquestion{Question}{%
{Proposition 1},
{Proposition 2},
{Proposition 3}}
\end{alterqcm}}

\end{document}

Although I've enlarged the vertical spacing, you can specify a fraction for \arraystretch or negative lengths for \extrarowheight.

This controls global changes for the entire alterqcm environment (header and body).

-
Thanks. I tried your approach and it works for enlarging the vertical space, however using fractions or negative lengths seems to have no effect. –  student Dec 29 '11 at 10:50
Any idea why fractions don't work? –  student Dec 30 '11 at 10:19
@user4011 Edit your example, it will be easier to reply –  Alain Matthes Jan 2 '12 at 16:57
@user4011: What did you use for a fraction? I meant something like 0.2, and not 1/5. –  Werner Jan 2 '12 at 17:04

Werner's answer is fine. Alterqcm uses a tabular and in the last version, I added a longtable option. In fact some problems arrive because one question or one proposition takes a lot of space. The good way is to use a global method like the FACTOR approach or like the LENGTH approach and then you can use a local approach.

You can modify the position of the questions with pq=..., the questions are moved inside the case. The modifications are global with \begin{alterqcm}[lq=85mm,pq=2mm]and local with \AQquestion[pq=6mm]{...}.

If you want more space for a one proposition, you can add something like \AQms(16,14). This a rule with no width ( a phantom ) and it's often very useful to put the proposition inside a minipage to get a correct result.

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}
\usepackage{alterqcm}

\parindent0pt
\begin{document}
\begin{alterqcm}[lq=8cm,language=english,pq=-6mm]
\AQquestion{Question}{%
{Proposition 1},
{Proposition 2},
{Proposition 3}}
\AQquestion[pq=0mm]{Question}{%
{Proposition 1},
{\AQms(16,14) Proposition 2},
{Proposition 3}}
\end{alterqcm}

\end{document}

Update with fractions. The first array is correct but if you use \arraystretchyou need to add pq=- ...to get a correct placement.

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage{amsmath,alterqcm}

\begin{document}

\begin{alterqcm}[lq=85mm]
\AQquestion{Pour tout réel $x$, le nombre $\dfrac{\text{e}^x - 1}{\text{e}^x + 2}\hskip12pt \text{égal à :}$ }
{{$-\dfrac{1}{2}$},
{$\dfrac{\text{e}^{-x} - 1}{\text{e}^{-x} + 2}$},
{$\dfrac{1 - \text{e}^{-x}}{1 + 2\text{e}^{-x}}$}
}
\AQquestion{On pose I $= \displaystyle\int_{\ln 2}^{\ln 3} \dfrac{1}{\text{e}^x - 1}\,\text{d}x$ et J $= \displaystyle\int_{\ln 2}^{\ln 3} \dfrac{\text{e}^x}{\text{e}^x - 1}\,\text{d}x$ \\ alors le nombre  I $-$ J est égal à}
{{$\ln \dfrac{2}{3}$},
{$\ln \dfrac{3}{2}$},
{$\dfrac{3}{2}$}
}
\end{alterqcm}

{\renewcommand{\arraystretch}{2}
\begin{alterqcm}[lq=85mm,pq=-4mm]
\AQquestion{Pour tout réel $x$, le nombre $\dfrac{\text{e}^x - 1}{\text{e}^x + 2}\hskip12pt \text{égal à :}$ }
{{$-\dfrac{1}{2}$},
{$\dfrac{\text{e}^{-x} - 1}{\text{e}^{-x} + 2}$},
{$\dfrac{1 - \text{e}^{-x}}{1 + 2\text{e}^{-x}}$}
}
\AQquestion{On pose I $= \displaystyle\int_{\ln 2}^{\ln 3} \dfrac{1}{\text{e}^x - 1}\,\text{d}x$ et J $= \displaystyle\int_{\ln 2}^{\ln 3} \dfrac{\text{e}^x}{\text{e}^x - 1}\,\text{d}x$ \\ alors le nombre  I $-$ J est égal à}
{{$\ln \dfrac{2}{3}$},
{$\ln \dfrac{3}{2}$},
{$\dfrac{3}{2}$}
}
\end{alterqcm} }

\end{document}

-