1

(Note: this is related to How to fix spacing with multi-line cgloss4e examples?)

I am trying to typeset linguistic examples with LaTeX, and in an a5 page setup. I am using linguex and cgloss4e. I need sometimes to input a first line that is not part of the example, which adds some space between the first line and the example (2nd line) & the gloss (3rd line), and also between the gloss and the translation (4th line). The addition of space is caused by flushleft, which is doing the alignment under the hood. (In order to see the results, comment out the part between *makeatletter* and *makeatother*; somehow I can't upload a screenshot to the page)

One workaround for the problem is to replace the flushleft environment by raggedright, as done in the patches between . However, this sometimes causes problems in that the line-ending is no longer correctly dealt with: the example does not respect the margin, and even goes beyond the page – which is not an issue with flushleft.

Is there a way of getting the same vertical space as with flushleft, and the same horizontal space as with raggedright, while continuing to use linguex?

Here is the MWE:

\documentclass[a5paper,12pt]{article}

\RequirePackage{geometry}% \geometry{headsep=3mm,includehead,margin=10mm,nofoot}% \usepackage{blindtext}

\usepackage{linguex,cgloss4e} \usepackage{etoolbox}

%% patches - comment out to see behavior with pure cgloss4e \makeatletter% Group everything to save the trouble \patchcmd{\gll}% The command to be patched {\begin{flushleft}}% Code to be replaced {\begingroup\raggedright}% New code {}{} \patchcmd{\gl@stop}% The command to be patched {\end{flushleft}}% Code to be replaced {\endgroup}% New code {}{} \makeatother %%% end patches \begin{document}

\blindtext{}

\ex. Meaningless example from Language \gll Kono kuruma-wa takai takai-koto-wa takai-desu-ka?\ This car-\textsc{top} expensive expensive-\textsc{nmlz}-\textsc{cont} expensive-\textsc{pred}.\textsc{polite}-Q\ `Is this car expensive?'

\end{document}

Alan Munn
  • 218,180

1 Answers1

0

You're missing \par in order to finish up the work of \raggedright. I also add \addvspace{\topsep} to get the same vertical spacing at the end as for flushleft.

\documentclass[a5paper,12pt]{article}

\usepackage{geometry} \geometry{headsep=3mm,includehead,margin=10mm,nofoot}

\usepackage{linguex,cgloss4e} \usepackage{etoolbox}

%% patches - comment out to see behavior with pure cgloss4e \makeatletter \patchcmd{\gll}% The command to be patched {\begin{flushleft}}% Code to be replaced {\begingroup\raggedright}% New code {}{} \patchcmd{\gl@stop}% The command to be patched {\end{flushleft}}% Code to be replaced {\par\addvspace{\topsep}\endgroup}% New code {}{} \makeatother %%% end patches \begin{document}

\ex. Meaningless example from Language \gll Kono kuruma-wa takai takai-koto-wa takai-desu-ka?\ This car-\textsc{top} expensive expensive-\textsc{nmlz}-\textsc{cont} expensive-\textsc{pred}.\textsc{polite}-Q\ `Is this car expensive?'

\end{document}

enter image description here

egreg
  • 1,121,712