1

Please, can someone explain how to patch Philex to customize the spacing between examples, subexamples and subsubexamples, respectively.

For example, if I want spacing between subexamples but no spacing between subsubexamples, and if I want even more spacing between examples than between subexamples.

Related page : Using linguex, how can I change the spacing between subexamples?

MWE :

  \documentclass[12pt,oneside]{article}
    \usepackage{philex}
    \usepackage{etoolbox}
    \newlength{\SubItemSkip}
    \setlength{\SubItemSkip}{.66\baselineskip}
    \makeatletter
    \patchcmd{\a}{\itemsep\z@}{\itemsep\SubItemSkip}{}{}
    \makeatother
    
    
\begin{document}
    
    \lb{tests}{
        \lba{inforx}{Possible modification by `in/for \textit{x} time'.}
        \lbb{fc}{Possible modification by \textit{frequent}/\textit{constant}.}
        \lbb{control}{Possible Implicit Agent Control.}
        \lbz{byp}{\textit{By}-phrases and, when available, possessives realize arguments.}}
    
    
    \lb{examples}{
        \lba{inforx-ex}{
            \lba{inx-ex}{La destruction de la ville par l'armée en quelques heures nous a stupéfaits.}
            \lbz{forx-ex}{Le chef de service a ordonné la surveillance du patient par les internes durant plusieurs jours.}}}
        
\end{document}

enter image description here

5
  • 2
    It would be helpful to show a compilable philex example that shows what you're doing. It seems likely that the solution I gave in the linked answer could be made to work but I know nothing about philex.
    – Alan Munn
    Mar 8 at 16:09
  • 1
    In fact, pasting the preamble code in my answer into a philex document seems to do what you want. If that's not what you want then explain what the problem is.
    – Alan Munn
    Mar 8 at 16:19
  • As I said, I'd like to differentiate between examples, subexamples and subsubexamples. I added a MWE. Thank you very much for your help. Mar 8 at 17:16
  • 1
    I'm sorry but your example doesn't help me understand where you want the extra space.
    – Alan Munn
    Mar 8 at 17:32
  • I don't have a definitive idea, but for example if I want spacing between subexamples but no spacing between subsubexamples, and if I want even more spacing between examples than between subexamples. Mar 8 at 17:37

1 Answer 1

1

Here's some code that allows you to set both the \topsep and the \itemsep values for the sub- and subsub-examples. The spacing between examples at the top level is simply a new paragraph, so there's no way to set that spacing; you can add \medskip or bigskip between examples if you need to. In this sample code, I've set different values for each one; it probably makes sense to have identical \topsep and \itemsep values for any one level, however.

Since this code only modifies linguex code, it will work equally well for linguex.

\documentclass{article}
\usepackage{philex}
\usepackage{etoolbox}
\newlength{\lngxtopsepii}
\setlength{\lngxtopsepii}{10pt}% linguex uses .3\Extopsep by default
\newlength{\lngxtopsepiii}
\setlength{\lngxtopsepiii}{5pt}
\newlength{\lngxitemsepii}
\setlength{\lngxitemsepii}{10pt}
\newlength{\lngxitemsepiii}
\setlength{\lngxitemsepiii}{5pt}
\makeatletter
\patchcmd{\a}{\ifnum\theExDepth=2\topsep .3\Extopsep\else\topsep 0pt\fi 
     \parsep\z@\itemsep\z@}
     {\ifnum\theExDepth>1\topsep\csname lngxtopsep\roman{ExDepth}\endcsname
     \itemsep\csname lngxitemsep\roman{ExDepth}\endcsname\else\topsep\z@\itemsep\z@\fi
     \parsep\z@}{}{}
\makeatother
\begin{document}

\lbp{clauses}{PP}{Some main words, followed by
\lba{first}{Time flies
\lba{firstnew}{Like an arrow}
\lbz{lastnew}{And much too fast}}
\lbb{second}{But never stops}
\lbz{last}{Which is lucky}
and a concluding comment.}

\medskip
\lbp{clauses}{PP}{Some main words, followed by
\lba{first}{Time flies
\lba{firstnew}{Like an arrow}
\lbz{lastnew}{And much too fast}}
\lbb{second}{But never stops}
\lbz{last}{Which is lucky}
and a concluding comment.}


\end{document}

Code explantion

The main example command in linguex is the \a macro, which sets up the \list environment that underlies the example. So we use the patching facilities of the etoolbox package to modify the definition of \a. The \patchcmd macro takes four arguments: the part of the original macro to be replaced, the replacement, and two arguments for "patch successful" and "patch unsuccessful". As long as we know the patch will work then these can safely be left empty.

So in the specific example here, I have replaced the linguex code that sets the \topsep and \itemsep of the list to code that sets the values dependent on the level of the list. I've named the lengths used with ii and iii suffixes so that I can construct the value from the list depth value using \roman{ExDepth}.

Output

output of code

5
  • Amazing, you are the best, Alan. Mar 14 at 21:20
  • 1
    @Vincent I've added some explanation of the code.
    – Alan Munn
    Mar 14 at 22:19
  • Ah ok ! So \roman{ExDepth} actually corresponds to the "ii" and "iii" suffixes added at the end of the "\lngxitemsep" and "\lngxtopsep" command names, and this is what lngxitemsep\roman{ExDepth} and lngxtopsep\roman{ExDepth} do , i.e. as arguments of \csname they define the suffixed command names ! Which is very flexible since it theoretically allows for deeper levels (within the limits inherent to the package, of course...) Mar 14 at 23:17
  • 1
    @Vincent Yes, this is correct. Although the kernel supports nesting up to 5 levels, linguex itself only defines labels up to 2 levels, so it's not practically extendable.
    – Alan Munn
    Mar 15 at 0:56
  • And for the space between the label and the sentence, this is : \SubExLeftmargin and \SubSubExleftmargin (thanks to frabjous as he kindly answered here tex.stackexchange.com/a/638271/262813). Mar 24 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.