LyXLinguistic Glosses in Examples not aligned in Book class

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
User avatar
Hiram
Posts: 15
Joined: Thu Nov 29, 2012 2:05 am

Linguistic Glosses in Examples not aligned in Book class

Post by Hiram »

Hi folks,

I'm having the same problem as this post from 2009, with Covington style linguistic glosses not aligning properly on the free translation line, but what solved their problem doesn't solve mine: http://comments.gmane.org/gmane.editors ... eral/58322

Does anyone have any suggestions? Basically, when I compile this LyX document in book format with chapter numbering turned on for examples, Examples 10 and 11 have a free translation (line 3) that doesn't line up with the rest of the example. I'm trying to figure out how to make the translation line up properly with the rest.
Examples.lyx
Lyx file for checking
(5.18 KiB) Downloaded 341 times
Also attached is an image of what the attached lyx document looks like when I compile to PDF.
Image file
Image file
Examples.jpg (52.09 KiB) Viewed 5664 times
Last edited by Hiram on Tue Jan 29, 2013 7:53 am, edited 4 times 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

Hiram
Posts: 15
Joined: Thu Nov 29, 2012 2:05 am

Linguistic Glosses in Examples not aligned in Book class

Post by Hiram »

Just to clarify, I try to use the following code in the Preamble, and it doesn't work:

Code: Select all

\renewenvironment{example}{%
\setlength\leftmargini{3.05em}
\begin{examples}%
\settowidth{\labelwidth}{(0.00)}%
\item}
{\end{examples}}
I'm wondering if there is a problem with the \renewenvironment - ie why doesn't it update the {example} environment?

Do I need to do something like globally setting the list environment? Like in this post: http://tex.stackexchange.com/questions/ ... 1128#91128
ie:

Code: Select all

\setlist[itemize]{leftmargin=*}
But what is the syntax I can use to globally set the \leftmargin for the example environment? Can I use the \let command to redefine the leftmargin properties for examples, as is done for figure centering in this post: http://stackoverflow.com/questions/1565 ... nvironment

ie:

Code: Select all

\let\oldfigure\figure
\def\figure{\oldfigure\centering}
I just don't know what the syntax should be, and what I've tried doesn't properly line up the third line of the gloss.
User avatar
Hiram
Posts: 15
Joined: Thu Nov 29, 2012 2:05 am

Linguistic Glosses in Examples not aligned in Book class

Post by Hiram »

I discovered a temporary workaround this morning. Unfortunately I have to type it in at every instance where the free translation is not aligned, but I can force-insert a space to the line using the \hspace*{} command, as in:

Code: Select all

\gll Example 1
example one
\glt \hspace*{0.1in}`this example no longer screws up'
Kind of annoying to adjust every single example, though. Is there a way to globally modify the equation numbering box for glosses? Or is there a way to locate the left margin of the previous sentence and start outputting the \glt line at that horizontal point?

Any help is greatly appreciated.
User avatar
Hiram
Posts: 15
Joined: Thu Nov 29, 2012 2:05 am

Linguistic Glosses in Examples not aligned in Book class

Post by Hiram »

Success! This now works, turns out I was trying to redefine the wrong environment the whole time ('example' instead of 'examples')! Thanks to Jürgen Spitzmüller on the other thread (http://comments.gmane.org/gmane.editors ... eral/58322) for this solution:
The tip on the wiki only changes the example (singular) environment.
To achieve the same with examples (plural), add the following to the
preamble;

\let\oldexamples\examples
\let\endoldexamples\endexamples
\renewenvironment{examples}{%
\setlength\leftmargini{3.05em}
\begin{oldexamples}%
\settowidth{\labelwidth}{(0.00)}}
{\end{oldexamples}}

HTH
Jürgen
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Linguistic Glosses in Examples not aligned in Book class

Post by scottkosty »

Hiram wrote:Success! This now works, turns out I was trying to redefine the wrong environment the whole time ('example' instead of 'examples')! Thanks to Jürgen Spitzmüller on the other thread (http://comments.gmane.org/gmane.editors ... eral/58322) for this solution:
The tip on the wiki only changes the example (singular) environment.
To achieve the same with examples (plural), add the following to the
preamble;

\let\oldexamples\examples
\let\endoldexamples\endexamples
\renewenvironment{examples}{%
\setlength\leftmargini{3.05em}
\begin{oldexamples}%
\settowidth{\labelwidth}{(0.00)}}
{\end{oldexamples}}

HTH
Jürgen
Many thanks for posting back with the solution, Hiram.
Jürgen also put the solution on this wiki page:
http://wiki.lyx.org/LyX.LinguistLyX

Scott
Post Reply