0

I rely heavily on ExPex and have a problem in automatically labeling subparts of multipart examples:

Consider the following construction:

\pex<like>
\a[label=0] I like X
\xe

Some folks might say something like:

\pex[exno=\getref{like}]
\a I like food
\a I like pens
\xe

Observe the similarity to the construction:

\pex<wantz>
\a[label=0] Me wantz X
\a Me wantz food
\a Me wantz pens
\xe

But there’s more!

\pex[exno=\getref{like}]
\a I like LaTeX
\a I like ExPex
\xe

I get the result on the left side but want the result on the right side:

In other words, I want the numbers of the subparts of a given multipart examples to just go on. I could do it using \a[label=] every time and keeping track by myself, but that seems tedious and unreliable.

I suspect that there is some way I could use \pexcnt to do the trick, but even after reading the manual a few times, I have not clue how to.

1 Answer 1

2

These ideas comes to my mind:

  • Create a command \saveseries{<name>} where <name> defines a macro (and therefore its syntax should be of a macro, i.e only letters) to save the current \pexcnt for later use. This command should be put at end of the \pex structure (before of \xe).

  • Create a command \resumeseries{<name>} for continuing labels in other \pex. This command must be put at begin of the other \pex structure (where you wish continuing the labeling), and don't forget to put the nopreamble option for avoiding a change of line.

Warnings

  • You must put again \saveseries{...} if you want to break the labeling in other block.
  • You must use a <name> in \resumeseries already defined with \saveseries to avoid an error like
`! Undefined control sequence.`

`<recently read> \<name>`

The full code

\documentclass{article}
\usepackage{expex}
\newcommand{\saveseries}[1]{\expandafter\xdef\csname #1\endcsname{\noexpand\pexcnt\the\pexcnt\relax}}
\newcommand{\resumeseries}[1]{\expandafter\csname#1\endcsname\ignorespaces}
\begin{document}
Consider the following construction:

\pex<like>
\a[label=0] I like X
\xe

Some folks might say something like:

\pex[exno=\getref{like}]
\a I like food
\a I like pens
\a I don't know
\saveseries{myserie}
\xe

Observe the similarity to the construction: 

\pex<wantz>
\a[label=0] Me wantz X
\a Me wantz food
\a Me wantz pens
\xe

But there’s more!

\pex[exno=\getref{like},nopreamble]  \resumeseries{myserie} 
\a I like LaTeX
\a I like ExPex
\xe
\end{document}

This is not sufficiently tested but I think the desired result is obtained.

enter image description here

1
  • Neat idea! Thanks a lot, it works better than expected! Commented Aug 18, 2014 at 19:35

You must log in to answer this question.

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