I'm currently working on my linguistics thesis, and I would like to add several example texts into the appendix. So I would like the ExPex numbering to restart from the beginning of every different text from (1). Is that achievable with ExPex?

Main document:

\usepackage{tipa} % IPA symbols. 
\usepackage{expex} % glossing



\lingset{glhangindent=0em} % adjust as necessary
\lingset{numoffset=0.5cm} % indentation for examples in expex
%\lingset{aboveexskip=0pt} % spacing between exs
\lingset{aboveglftskip=-0.3pt} %spacing before glft





I have examples in each chapter and they are numbered from (1) until whatever, and now I would like the texts in the appendix number from (1) for each text (Text 1 and Text 2). Appendix:

\chapter{Example texts}
\section{Text 1}
\ex Line 1 \xe
\ex Line 2 \xe

\section{Text 2}
\ex Line 1 \xe
\ex Line 2 \xe
  • Could you please show us a MWE ? meta.tex.stackexchange.com/questions/3300/… – flav Jan 18 '16 at 7:56
  • look here : en.wikibooks.org/wiki/LaTeX/Counters – flav Jan 18 '16 at 8:25
  • The example you've posted isn't really a minimal example for your question. The full document doesn't have any example (\ex ... \xe) code, has more structure than is needed and uses \include, which doesn't help since we don't have your included files (and they are not necessary in this case). See my answer for a more perspicuous MWE for this question. – Alan Munn Jan 18 '16 at 15:07

The ExPex package uses its own counter/reference system which is quite powerful but somewhat idiosyncratic. It's also usable with the regular LaTeX \label and \ref system but without the extra functionality of its built-in system.

The main counter used by ExPex is \excnt but this is a TeX count register and not a LaTeX counter, so it cannot be set and reset using the regular LaTeX methods. Instead, you set it directly by using the TeX syntax \excnt=1.

If you want example numbers to start at 1 for each chapter automatically you can do the following:

% Restart numbering each chapter

\ex An example \xe
\ex An example \xe
\ex An example \xe
\ex An example \xe
% If numbering is to restart only here, put the \pretocmd line here
\ex An example \xe
\ex An example \xe

If you only want to restart for the appendices, then you can put the \pretocmd line right after the \appendix command in your document.


how to set a counter :









1 test1

2 test2

11 test3

12 test4

13 test5

14 test6

  • Thank you very much, the counter I wanted to set is the number of linguistic examples inside expex, not the number of the section... and I still haven't figured out how to do that after reading that wiki page :( – balivon Jan 18 '16 at 8:56
  • Look in the package documentation : mirrors.ircam.fr/pub/CTAN/macros/plain/contrib/expex/… you have some counters. – flav Jan 18 '16 at 9:12
  • Many thanks, it turned out that I just needed to set \excnt=1 at the place where I want to reset... :) – balivon Jan 18 '16 at 9:31
  • 1
    This isn't an answer to the question. ExPex doesn't use regular LaTeX counters, so you can't set and reset them with regular LaTeX methods. I don't want to discourage you from answering, but if a question is about a specific package, and you're not familiar with it, perhaps you should think twice before you answer, or at least test your answer with the package loaded. – Alan Munn Jan 18 '16 at 14:56
  • @AlanMunn thanks for your advice, I will take care the next time. Do I have to delete my answer ? – flav Jan 18 '16 at 15:01

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.