GeneralReducing space between gloss items in gb4e's xlist and exe

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
latexnoob2022
Posts: 7
Joined: Thu Jan 20, 2022 6:21 am

Reducing space between gloss items in gb4e's xlist and exe

Post by latexnoob2022 »

I am trying to reduce the `itemsep', `parskip' and `parsep' spacing within each instance of the `exe' and `xlist' environment.

So far, the only thing that has worked as been this (in-line code below):

Code: Select all

\documentclass[11pt]{article}
\usepackage{gb4e}
  \noautomath
\begin{document}
    \begin{exe}
        \setlength{\itemsep}{0pt}
        \setlength{\parskip}{-3pt}
        \setlength{\parsep}{-1pt}
      \ex Is apt
        \begin{xlist}
            \setlength{\itemsep}{-1pt}
            \setlength{\parskip}{-1pt}
            \setlength{\parsep}{-1pt}
          \ex e
          \ex c
        \end{xlist}
    \end{exe}
\end{document}
I was wondering if there is a way to use ` \renewenvironment{xlist}' to set this for the entire document? the Following returned an error (MWE for the preamble):

Code: Select all

\documentclass[11pt]{article}
\usepackage{gb4e}
  \noautomath
    \renewenvironment{xlist}{ 
        \setlength{\itemsep}{-2pt}
        \setlength{\parskip}{-2pt}
        \setlength{\parsep}{-2pt}
  	}
    \renewenvironment{exe}{ 
        \setlength{\itemsep}{-2pt}
        \setlength{\parskip}{-2pt}
        \setlength{\parsep}{-2pt}
	}
\begin{document}
    \begin{exe}
        \setlength{\itemsep}{0pt}
        \setlength{\parskip}{-3pt}
        \setlength{\parsep}{-1pt}
      \ex Is apt
        \begin{xlist}
            \setlength{\itemsep}{-1pt}
            \setlength{\parskip}{-1pt}
            \setlength{\parsep}{-1pt}
          \ex e
          \ex c
        \end{xlist}
    \end{exe}
\end{document}
I am trying to understand if this is interfering with how `gb43' sets up the list environments, or a problem with my syntax?

I would really appreciate any help on this!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

MjK
Posts: 89
Joined: Fri Jan 28, 2022 6:09 pm

Reducing space between gloss items in gb4e's xlist and exe

Post by MjK »

You cannot use \renewcommand this way. You cannot use it to change only some parameters. You always have to do a complete environment definition. And you always have to redefine the begin and the end part not only the begin part.

Moreover, to redefine exe you should redefine (or patch → xpatch) the internal command \@exe. You can find the original code in file gb4e.sty of your TeX distribution.

Similar for xlist. Here you have to redefine/patch \@xlist and maybe also \@subex, because the last one changes \parsep.

Maybe you can also ask the package maintainer to implement an interface similar to enumitem to make the package more configurable.
My main topics are KOMA-Script and other questions related to my packages. If I reply to any other topic or if you've not yet added a minimal working example, please do not expect any further response. And please don't forget to tag examples as code.
latexnoob2022
Posts: 7
Joined: Thu Jan 20, 2022 6:21 am

Reducing space between gloss items in gb4e's xlist and exe

Post by latexnoob2022 »

MjK wrote:You cannot use \renewcommand this way. You cannot use it to change only some parameters. You always have to do a complete environment definition. And you always have to redefine the begin and the end part not only the begin part.

Moreover, to redefine exe you should redefine (or patch → xpatch) the internal command \@exe. You can find the original code in file gb4e.sty of your TeX distribution.

Similar for xlist. Here you have to redefine/patch \@xlist and maybe also \@subex, because the last one changes \parsep.

Maybe you can also ask the package maintainer to implement an interface similar to enumitem to make the package more configurable.

Thank you for your response. I'll try making changes to the .sty file.
User avatar
MjK
Posts: 89
Joined: Fri Jan 28, 2022 6:09 pm

Reducing space between gloss items in gb4e's xlist and exe

Post by MjK »

latexnoob2022 wrote: Thank you for your response. I'll try making changes to the .sty file.
You should never change the files of a package from someone else, i.e., not the files of any TeX distribution. Doing so often results in a mess of unmaintainable TeX installations and at least in non-portable documents to which you cannot get any support at least not without breaking licenses. If the license allows to do so, either make a copy, rename the files and then change the renamed files. Or alternatively—and this is often the better choice—copy the relevant code to your document preamble and change it there. But what ever you'd do: Don't forget to add sufficient comments to know, where the code comes from, what you've changed and why you've done so.
My main topics are KOMA-Script and other questions related to my packages. If I reply to any other topic or if you've not yet added a minimal working example, please do not expect any further response. And please don't forget to tag examples as code.
latexnoob2022
Posts: 7
Joined: Thu Jan 20, 2022 6:21 am

Reducing space between gloss items in gb4e's xlist and exe

Post by latexnoob2022 »

That was my plan- it didn't make sense to change the original file and mess up my distribution. thank you!
latexnoob2022
Posts: 7
Joined: Thu Jan 20, 2022 6:21 am

Reducing space between gloss items in gb4e's xlist and exe

Post by latexnoob2022 »

latexnoob2022 wrote:
MjK wrote:You cannot use \renewcommand this way. You cannot use it to change only some parameters. You always have to do a complete environment definition. And you always have to redefine the begin and the end part not only the begin part.

Moreover, to redefine exe you should redefine (or patch → xpatch) the internal command \@exe. You can find the original code in file gb4e.sty of your TeX distribution.

Similar for xlist. Here you have to redefine/patch \@xlist and maybe also \@subex, because the last one changes \parsep.

Maybe you can also ask the package maintainer to implement an interface similar to enumitem to make the package more configurable.
I have been working on this problem and have an alternative approach- can these changes to \@exe be made to my LaTeX document, rather than the .sty file? This way I don't harm the distribution, but get my results.

Alternatively, is there a method/macro to make my document replace all instances of \begin{exe} and \begin{xlist} with:

\begin{exe}
\setlength{\itemsep}{0pt}
\setlength{\parskip}{-3pt}
\setlength{\parsep}{-1pt}


and
\begin{xlist}
\setlength{\itemsep}{0pt}
\setlength{\parskip}{-3pt}
\setlength{\parsep}{-1pt}



Your help is greatly appreciated!
Post Reply