Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to split examples in the \usepackage{gb4e} to get explanatory remarks as close to the explained item as possible. Usually, my typeset examples are looking like this:

(1) blabla
(2) a. blabla,
    b. blabla
    c. blabla
(3) blabla bal

Then I provide some explanatory remarks.

This is produced by:

\begin{exe}
  \ex  blabla
  \ex \begin{xlist}
      \ex blabla
      \ex blabla
      \ex blabla
    \end{xlist}
  \ex blabla bla
\end{exe}

I would like the examples to look either like this...

(1) blabla
(2) a. blabla,
    b. blabla

Some explanatory remarks. Some explanatory remarks. Some explanatory remarks. 
Some explanatory remarks. Some explanatory remarks.  

    c. blabla
(3) blabla bal

...or like this:

(1) blabla
(2) a. blabla,
    b. blabla

Some explanatory remarks. Some explanatory remarks. Some explanatory remarks. 
Some explanatory remarks. Some explanatory remarks.

(2) c. blabla
(3) blabla bal

The latter option repeats the number "(2)" before "c.", the other doesn't.

So the idea is to divide examples into several pieces and give some explanations in between. The ideal answer would begin like this:

\begin{exe}
  \ex  blabla
  \ex \begin{xlist}
      \ex blabla
      \ex blabla
    \end{xlist}
\end{exe}

Explanatory remarks...

The remaining commands/environments I don't know how to generate. I guess there is a way doing it based on \setcounter. But if this would work, I wouldn't know how to get a solution without the number.

share|improve this question
2  
I really don't recommend doing this. It's not used by any major journal in the field, and it's just really bad style. If you really need to split up a set of examples, then you should number them separately. –  Alan Munn Dec 23 '12 at 4:36
    
This is my personal approach. I never saw it in any linguistic journal (what doesnt mean a lot). But that you might not find it in any journals doesnt necessarily mean that it is bad style. I feel that people should be open to new approaches what in particular holds for scientists. The main effect I am hoping for is this: You see that a usually splitted number of examples are more closely related and by this it enhances the structure and readability of your document. –  Philip Dec 24 '12 at 11:16
add comment

2 Answers

up vote 6 down vote accepted

Against my better judgement, here's a way to get your both of your suggested formats. We save the counter value and use the gb4e macro \exr to refer to the label of the split example for the second format, and use the gb4e macro \sn to get the first format. I don't recommend using either of these, however.

\documentclass{article}
\usepackage{gb4e}
\newcounter{savedex}
\makeatletter
\newcommand*{\saveex}{\setcounter{savedex}{\value{\@xnumctr}}}
\newcommand*{\resumeex}{\setcounter{\@xnumctr}{\value{savedex}}}
\makeatother
\begin{document}
\noindent This is some text.

\begin{exe}
\ex\label{1}
  \begin{xlist}
    \ex This is an example.
    \ex This is another example.
    \saveex
  \end{xlist}
\end{exe}

\noindent These are some remarks about this example.

\begin{exe}
\exr{1}
  \begin{xlist}
    \resumeex
    \ex An example.
    \ex Another example.
    \saveex
  \end{xlist}
\end{exe}

\noindent some more remarks.

\begin{exe}
\sn
  \begin{xlist}
    \resumeex
    \ex An example.
    \ex Another example.
  \end{xlist}
\end{exe}
\end{document}

output of code

share|improve this answer
    
Thank you very much. It works perfectly well! –  Philip Dec 24 '12 at 11:27
add comment

Edit1: solution with gb4e + float

M

In response to Alan Munn comments, to maintain the gb4e package and split the sublist with remarks without any indentation, a solution could be a new float environment with the H option, although this can produce the usual problems of floats (too many floats,etc.):

\documentclass{article}    
\usepackage[utf8]{inputenc}    
\usepackage{gb4e}    
\usepackage{float}
\newfloat{remarks}{H}{rem}
\setlength{\textfloatsep}{0em} 
\setlength{\abovecaptionskip}{0em}
\setlength{\belowcaptionskip}{0em}
\restylefloat{remarks}
\begin{document}
\begin{exe}
  \ex  blabla
  \ex \begin{xlist}
      \ex blabla
      \ex blabla
\begin{remarks}
Some explanatory remarks. 
Some explanatory remarks. 
Some explanatory remarks. 
Some explanatory remarks.  
\end{remarks}
      \ex blabla
    \end{xlist}
  \ex blabla bla
\end{exe}
\end{document}

As for me this is also a bad idea, I left my original answers withouth gb4e with references at the end of sublists although this can be done with this package (and I think that with linguex or philex as well).

\documentclass{article}
\newcounter{example}
\setcounter{example}{0}
\newenvironment{examples}{%
  \list{(\theexample)}%
  {\def\example{\refstepcounter{example}\item}%
    \settowidth{\leftmargin}{10.\hskip\labelsep}%
    \labelwidth\leftmargin\advance\labelwidth-\labelsep}}
{\endlist}

\newcounter{partno}
\renewcommand\thepartno{\alph{partno}}
\newenvironment{parts}{\list{\thepartno.}%
{\def\part{\item}%
 \usecounter{partno}%
 \settowidth{\leftmargin}{(m)\hskip\labelsep}%
 \labelwidth\leftmargin\advance\labelwidth-\labelsep}}%
{\endlist}

\begin{document}

\begin{examples}
  \example Bla bla bla 
  \example \label{second} Bla bla bla 
    \begin{parts}
    \part Bla bla bla 
    \part \label{second-b} Bla bla bla 
     \end{parts}
\end{examples}

\noindent Some explanatory remarks 
on \ref{second}.\ref{second-b}. 
Some explanatory remarks. Some explanatory remarks.
Some explanatory remarks. Some explanatory remarks.  


\begin{examples}
  \example Bla bla bla
  \example \label{fourth} Bla bla bla
  \end{examples}

\noindent Some explanatory remarks on \ref{fourth}.
Some explanatory remarks. Some explanatory remarks.
Some explanatory remarks. Some explanatory remarks.  

\end{document}
share|improve this answer
    
This doesn't actually answer the question: the idea is that the remarks are in the middle of the list, so that some part of the list is before the remarks and some part (of the continued list) is after. Also, the gb4e package does other things than just list numbering, so a solution not using the package isn't ideal. –  Alan Munn Dec 23 '12 at 4:26
1  
@AlanMunn. Yes, not in the middle of the sublist, but in the middle of the (continued) main list. This is why are references in the remarks (on my modest opinion, more stylish that break the sublists). –  Fran Dec 23 '12 at 11:16
    
But this is how the gb4e package works in the first place: main examples are numbered consecutively throughout the document. –  Alan Munn Dec 23 '12 at 14:05
    
@AlanMunn, I see, I updated my answer. –  Fran Dec 23 '12 at 19:12
    
Thank you so much. It works perfectly well! I prefer Alan Munn´s solution because it seems more user-friendly when using larger examples with a high level of complexity. –  Philip Dec 24 '12 at 11:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.