3

I am using the lingmacros package for numbered examples. By default it works like this:

\enumsentence{This is the first example.}
\enumsentence{This is the second example.}

(1) This is the first example.

(2) This is the second example.

I'd like to add chapter numbers in the parentheses.

If I change the following line in the .sty file, it adds the chapter numbers:

-{\refstepcounter{enums}\@enumsentence[(\theenums)]}}
+{\refstepcounter{enums}\@enumsentence[(\arabic{chapter}.\theenums)]}}

Question: what do I add to the document's preamble so that I get the same result without modifying the .sty file?

Also, I'd like to decrease the space between examples. I'm using the following in my document but it doesn't affect the examples:

\usepackage{enumitem}
\setlist{topsep=0pt, partopsep=0pt, parsep=0pt, itemsep=0pt}
Alan Munn
  • 218,180
Andy K.
  • 171
  • 1
    Do you have a lot of code/time invested in lingmacros? It's a very old package, and there are better packages available for example numbering: Numbered examples in linguistics that I can refer back to. – Alan Munn Nov 30 '14 at 17:11
  • @AlanMunn No, I'm only starting to use it. First I tried gb4e but it wouldn't work (probably because of underscore symbols in my document which I'm unable to replace). Thanks a lot for the link! Which package would you recommend for my task? I mostly need just simple examples. – Andy K. Nov 30 '14 at 17:24
  • 1
    I prefer gb4e because its markup is more semantic. Load gb4e late in the loading sequence of packages, and add \noautomath right after you load the package to turn off the underscore features. Lots of people like linguex as well, and it has more parameters that you can tweak for adjusting the spacing. To adjust counter dependencies without modifying the package, I use the chngcntr package. For your case and gb4e you would use \usepackage{chngcntr}\counterwithin{xnumi}{chapter} – Alan Munn Nov 30 '14 at 17:27
  • @AlanMunn Thank you, I'll stick with gb4e then, it's working now. The numbering is working well, too (I also checked this solution: http://tex.stackexchange.com/questions/116798/gb4e-enumeration-format) – Andy K. Nov 30 '14 at 17:33
  • 1
    Great, I forgot to mention that you also need to add \counterwithin{exx}{chapter} to reset the example numbers each chapter. – Alan Munn Nov 30 '14 at 17:35
  • I'll convert the comment thread into an answer in case other people encounter your question. – Alan Munn Nov 30 '14 at 17:37

1 Answers1

3

The lingmacros package is very old, and is really not very practical for numbering anything other than the most basic examples. For instance, it requires you to label subexamples manually, which really defeats the purpose of LaTeX and automatic numbering of things.

See the following question for a summary of three widely used packages for linguistic example numbering:

My personal preference is for the gb4e package because the markup is more semantic. But linguex has a bit more flexibility in formatting the examples. Because gb4e messes with the use of _ and ^ outside of math mode, it's best to load it late in the loading order of packages. To turn off this function use the command \noautomath immediately after loading the package.

For changing changing all sorts of counter dependencies, the chngcntr package is extremely handy. To see how to do this for gb4e see the following question:

Alan Munn
  • 218,180