GeneralAdditional space within glossed examples

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jfontana
Posts: 3
Joined: Tue Jul 30, 2013 1:47 pm

Additional space within glossed examples

Post by jfontana »

Hi,

I'm preparing a presentation (using Beamer) where I need to include glossed examples. I'm using the Linguex macros (with package cgloss4e from gb4e). My problem is that in some cases the examples are very long and extend over more than two lines. This makes it very difficult for people to distinguish the example from its gloss. So what I get is something like the following:

Code: Select all

(1) example text example text example text text example text example text
    gloss text gloss text gloss text gloss text gloss text gloss text
    example text example text example text text example text example text
    gloss text gloss text gloss text gloss text gloss text gloss text
    example text example text example text text example text example text
    gloss text gloss text gloss text gloss text gloss text gloss text

    "Translation text Translation text Translation text Translation text
     Translation text Translation text Translation text Translation text
     Translation text "
What I would like to be able to do is leave an extra line between each pair of example - gloss lines so that I get something like:

Code: Select all

(x) example text example text example text text example text example text
    gloss text gloss text gloss text gloss text gloss text gloss text

    example text example text example text text example text example text
    gloss text gloss text gloss text gloss text gloss text gloss text

    "Translation text Translation text Translation text Translation text
    Translation text Translation text Translation text Translation text"
The regular command to do this does not seem to work within an example. So, while adding \\~\\ works perfectly to leave an extra space between the example-gloss section and the translation, it doesn't do anything when it is added between the example and the gloss.

I imagine that this is a common problem since I have seen many publications where there is additional space between each pair of lines and it is hard to believe that none of these documents has been created using LaTeX. I really haven't been able to figure out how to do it, though.

One thing that I have managed to do in order to alleviate the problem is to change the font of the gloss or the example by adding commands such as the following to the preamble:

Code: Select all

\let\eachwordone=\rmfamily  
This makes things a bit better but here the problem I have is that I cannot make the characters appear in italics by adding the following

Code: Select all

\let\eachwordone=\rmfamily\itshape
With \let\eachwordone= it doesn't seem to be possible to combine font family and font shape.

Thanks in advance for any help you can offer on any of these problems.

I'm including the preamble of the document

Best,

Josep M.
Last edited by cgnieder on Wed Jul 31, 2013 12:11 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Additional space within glossed examples

Post by cgnieder »

Hi Josep,

Welcome to the LaTeX community!

The \let primitive lets one token to be equal to another token. The syntax is:

Code: Select all

\let<token1>=<token2>
or

Code: Select all

\let<token1><token2>
This means if you say

Code: Select all

\let\eachwordone=\rmfamily\itshape
You set \eachwordone to be equal to \rmfamily and then you call \itshape independently.

You may want

Code: Select all

\def\eachwordone{\rmfamily\itshape}
or using the more LaTeX-like syntax

Code: Select all

\renewcommand*\eachwordone{\rmfamily\itshape}
I'm not sure, though. Since you haven't provided a Infominimal working example I haven't tested this. It also means I cannot comment on the vertical space issue. We would need to see some compilable (but minimal!) code that shows the issue. However, \\~\\ surely is wrong LaTeX syntax.

Regards
site moderator & package author
jfontana
Posts: 3
Joined: Tue Jul 30, 2013 1:47 pm

Additional space within glossed examples

Post by jfontana »

Thanks Clemens!

Sorry about not providing the minimal working example. I include it at the end of this message. I got the changes I wanted in the font shape using \def instead of \let. Thanks for the tip!

As for the additional space, here's one of the long examples I was talking about. Having the example in a different font and shape from the gloss helps quite a bit but if it is possible at all, I would still like to try to increase the space between each pair of example-gloss lines a bit. Hopefully the minimal working example I include below can offer some clues to find an appropriate solution.

I'm a bit confused about your comment on the \\~\\ command. I would swear I got this from the "official" documentation of one of the macros. Not that this would make it right if it is indeed the wrong LaTeX syntax but what I can say is that it works perfectly to add the extra line between the example and the translation and there are no problems or error messages when it compiles.

JM.


--------- minimal working example --------------

Code: Select all

\documentclass{beamer}

\mode<presentation>
{
%\usetheme{Luebeck}
 \usetheme{Frankfurt}
  % or ...
  \setbeamercovered{transparent}
  % or whatever (possibly just delete it)
}

%[...]
\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{xspace}

\usepackage{cgloss4e}

\setmainfont{Trebuchet MS}

\setromanfont[Mapping=tex-text]{Georgia}

\usepackage{linguex}
\usepackage{graphicx}

\nosinglegloss

\def\eachwordone{\rmfamily\itshape}

%[...]

\begin{document}
\begin{frame}{Diachronic data: killing and dying}

\begin{itemize}
\item Killing and dying revisited.
\end{itemize}

\exg. ...\textbf{mataren} Tosadeu e aconseguiren lo gran Tireus famós; e per la reyna Atar dels gots fo \textbf{mort} Darí e Dapís e lurs fills foren vençuts e presos.    \\
 killed.3PL Tosadeu and got the bit Tireus famous; and by the queen Atar {of the} goths was "killed" Darí and Dapís and their sons were defeated and imprisoned. \\
\trans `They killed Tosadey and got the big and famous Tireus; and Darí was killed by Atar, the queen of the Goths, and Dapís and their sons were defeated and imprisoned'
\hfill (\textit{Històries e conquestes del realme d’Aragó e principat de Catalunya})

\end{frame}


%[...]

\end{document}
Last edited by cgnieder on Fri Aug 02, 2013 4:17 pm, edited 1 time in total.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Additional space within glossed examples

Post by cgnieder »

jfontana wrote:I'm a bit confused about your comment on the \\~\\ command. I would swear I got this from the "official" documentation of one of the macros. Not that this would make it right if it is indeed the wrong LaTeX syntax but what I can say is that it works perfectly to add the extra line between the example and the translation and there are no problems or error messages when it compiles.
Well, this happens if no MWEs are provided ;) apparently the

Code: Select all

\exg ... \\
is the correct syntax for linguex. My comment was due to the fact that way too many LaTeX users use \\ in order to end an paragraph (which it doesn't do) and then wonder why things are looking strange or why they're getting warning messages.

How about this:

Code: Select all

% arara: xelatex
\documentclass{beamer}

\mode<presentation>
  {
    \usetheme{Frankfurt}
    \setbeamercovered{transparent}
  }

\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{xspace}

\usepackage{cgloss4e}
\usepackage{linguex}

\usepackage{graphicx}

\nosinglegloss

\def\eachwordone{\rmfamily\itshape}

\begin{document}

\begin{frame}{Diachronic data: killing and dying}

\begin{itemize}
  \item Killing and dying revisited.
\end{itemize}

\exg. \ldots\textbf{mataren} Tosadeu e aconseguiren lo gran Tireus famós; e
per la reyna Atar dels gots fo \textbf{mort} Darí e Dapís e lurs fills foren
vençuts e presos. \\
killed.3PL Tosadeu and got the bit Tireus famous; and by the queen Atar {of
  the} goths was "killed" Darí and Dapís and their sons were defeated and
imprisoned. \\
\medskip
\trans `They killed Tosadey and got the big and famous Tireus; and Darí was
killed by Atar, the queen of the Goths, and Dapís and their sons were defeated
and imprisoned' \hfill (\textit{Històries e conquestes del realme d’Aragó e
  principat de Catalunya})

\end{frame}

\end{document}
linguex.png
linguex.png (68.92 KiB) Viewed 8563 times
Regards
site moderator & package author
jfontana
Posts: 3
Joined: Tue Jul 30, 2013 1:47 pm

Additional space within glossed examples

Post by jfontana »

Thanks again, Clemens.

In the code you proposed '\medskip' adds extra space between the example and the translation. This works perfectly. This command, however, does not work to add an extra space between each pair of lines containing the example and the gloss. The effect I'm looking for is something like the following with the added space being a little smaller (1.5 lines instead of 2).

Code: Select all

 \documentclass{beamer}

    \mode<presentation>
    {
    \usetheme{Frankfurt}
    \setbeamercovered{transparent}
    }

    \usepackage{fontspec}
    \usepackage{xcolor}
    \usepackage{xspace}

    \usepackage{cgloss4e}
    \usepackage{linguex}

    \usepackage{graphicx}

    \nosinglegloss

    \def\eachwordone{\rmfamily\itshape}

    \begin{document}

    \begin{frame}[squeeze, shrink=12]{Diachronic data: killing and dying}

    \begin{itemize}
    \item Killing and dying revisited.
    \end{itemize}
\medskip

\ldots\textbf{mataren} Tosadeu e aconseguiren lo gran Tireus famós; e \newline
    killed.3PL Tosadeu and got the bit Tireus famous; and \newline \newline
    
    per la reyna Atar dels gots fo \textbf{mort} Darí e Dapís e lurs \newline
     by the queen Atar of he goths was``killed" Darí and Dapís and their  \newline \newline
    
    fills  foren vençuts e presos. \newline
    sons were defeated and imprisoned. \newline \newline
   `They killed Tosadey and got the big and famous Tireus; and Darí was
    killed by Atar, the queen of the Goths, and Dapís and their sons were defeated
    and imprisoned' 
    \hfill (\textit{Històries e conquestes del realme d’Aragó e principat de Catalunya})

    \end{frame}

    \end{document}
Attachments
Screen shot 2013-08-02 at 8.21.00 PM.png
Screen shot 2013-08-02 at 8.21.00 PM.png (74.53 KiB) Viewed 8557 times
User avatar
Hiram
Posts: 15
Joined: Thu Nov 29, 2012 2:05 am

Additional space within glossed examples

Post by Hiram »

Hi Josep,

I remember trying to work something like this out before, albeit using a slightly different glossing package. Since you're using the cgloss4e.sty I thought I'd take a look at it and see what the options are for changing spacing.

I took your minimal example and ran it through, then copied bits of code from cgloss4e to my document's preamble and added other bits to it until I got something that seemed the work. This is not an ideal situation, being quite a hack - I welcome input from more advanced users on how to change spacing properly (perhaps a new command?).

If you paste the following code into your document's preamble, after having loaded the cgloss4e package, this should change the spacing. I added the \vskip.3\baselineskip (line 11). If you change the number .3 this will adjust the vertical space between paired lines in your example.

Code: Select all

\gdef\twosent#1\\ #2\\{% #1 = first line, #2 = second line
    \getwords(\lineone,\eachwordone)#1 \\%
    \getwords(\linetwo,\eachwordtwo)#2 \\%
    \loop\lastword{\eachwordone}{\lineone}{\wordone}%
         \lastword{\eachwordtwo}{\linetwo}{\wordtwo}%
         \global\setbox\gline=\hbox{\unhbox\gline
                                    \hskip\glossglue
                                    \vtop{\box\wordone   % vtop was vbox
                                       \nointerlineskip
                                          \box\wordtwo
                                          \vskip.3\baselineskip
                                         }%
                                   }%
         \testdone
         \ifnotdone
    \repeat
    \egroup % matches \bgroup in \gloss
   \gl@stop}
The \vskip value is currently .3\baselineskip - you can also replace that whole piece of code with an actual value, say 5pt or something else.

Hope that helps.
Post Reply