2

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:

\documentclass[12pt,twoside,a4paper]{book}
\usepackage{tipa} % IPA symbols. 
\usepackage{expex} % glossing

\begin{document}

\frontmatter
\maketitle

%expex
\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

\tableofcontents

\mainmatter
\include{Chapter1/chapter1}
\include{Chapter2/chapter2}

\appendix
\include{AppendixA/appendixa}

\backmatter
\end{document}

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
3
  • Could you please show us a MWE ? meta.tex.stackexchange.com/questions/3300/…
    – flav
    Jan 18, 2016 at 7:56
  • look here : en.wikibooks.org/wiki/LaTeX/Counters
    – flav
    Jan 18, 2016 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, 2016 at 15:07

2 Answers 2

5

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:

\documentclass{book}
\usepackage{expex}
% Restart numbering each chapter
\usepackage{etoolbox}
\pretocmd{\chapter}{\excnt=1}{}{}

\begin{document}
\chapter{Foo}
\ex An example \xe
\ex An example \xe
\chapter{Bar}
\ex An example \xe
\ex An example \xe
\appendix
% If numbering is to restart only here, put the \pretocmd line here
\chapter{Appendix}
\ex An example \xe
\ex An example \xe
\end{document}

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

0

how to set a counter :

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}

\begin{document}
\section{test1}
\label{sec:test1}

\section{test2}
\label{sec:test2}


\setcounter{section}{10}
\section{test3}
\label{sec:test3}

\section{test4}
\label{sec:test4}

\section{test5}
\label{sec:test6}

\section{test6}
\label{sec:test6}


\end{document}

1 test1

2 test2

11 test3

12 test4

13 test5

14 test6

5
  • 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, 2016 at 8:56
  • Look in the package documentation : mirrors.ircam.fr/pub/CTAN/macros/plain/contrib/expex/… you have some counters.
    – flav
    Jan 18, 2016 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, 2016 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, 2016 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, 2016 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .