Академический Документы
Профессиональный Документы
Культура Документы
Questions
Tags
Users
Badges
log in
tour
help
search
Unanswered
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.
Ask Question
I'm writing a linguistics paper that uses a large amount of linguistic examples from a wide variety of
languages, using the gb4e package. I want to be able to label each example with information about the
language it comes from, as I've seen in some texts, sort of like this:
asked
3 years ago
2 months ago
Upcoming Events
Answer the Unanswered
in 4 days
gb4e is great at formatting the examples themselves, but I can't seem to get the label placed where I
want it, that is, placed immediately before the example and without an indent. Here's some example
code:
\documentclass{article}
\usepackage{gb4e}
\usepackage{lipsum}
pdfcrowd.com
\begin{document}
\lipsum[2]
Hungarian (Finn-Ugric, \emph{reference})
\begin{exe}
\ex \gll
J\'anos h\'aza\\
John house.his\\
\glt
`John's house'
\end{exe}
Get the weekly newsletter!
\lipsum[3]
\end{document}
If the label text is outside the exe environment, it's treated like a regular paragraph, but if I try to put it
inside, it gives me an error. How can I make it look the way I want? I've looked at other packages that
do numbered examples, but they don't seem to have solutions either, and they also don't have the
same functionality as gb4e that I need.
Important announcements
Unanswered questions
Sign up for the newsletter
Linked
edited Nov 16 '13 at 5:26
Alan Munn
92k
14
Garrett
245
403
43
10
I have edited your question to include lipsum package for introducing dummy text for better readability and
focus, you can also use egreg's kantlipsum package for the same purpose. Please rollback if this is not
desired. percusse Mar 27 '12 at 3:19
Didn't even know those existed. Thank you! Garrett Mar 27 '12 at 14:07
add a comment
Related
6 Answers
active
oldest
votes
If you use Alexis Dimitriadis' version of cgloss4e available here as cgloss.sty you can put
pdfcrowd.com
12
language information right aligned with the first line of the example. This is IMO a very nice way to
format such information, and quite common in the field:
\documentclass{article}
\usepackage{gb4e}
\usepackage{cgloss}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\begin{exe}
\ex \gll
J\'anos h\'aza\\
John house.his\\ \hfill Hungarian (Finno-Ugric, \emph{reference})
\glt
`John's house'
\end{exe}
\lipsum[3]
\end{document}
Unnumbered linguistic
examples with glosses
pdfcrowd.com
\glt
`John's house'
\lipsum[3]
\end{document}
14
245
403
That does look nice. Does cgloss4e otherwise work the same as gb4e? I noticed it's not included in Texlive.
Garrett Mar 27 '12 at 14:11
1
cgloss4e is loaded by gb4e ; it's the part that handles the glosses and part of the regular gb4e
distribution. You don't see it because you usually never load it by itself. cgloss is a replacement for
pdfcrowd.com
cgloss4e not for gb4e itself. But yes, it works identically as far as I know. I'm not sure why Alexis has
never put it up on CTAN. Alan Munn Mar 27 '12 at 14:16
1
So if I load cgloss , does it automatically replace cgloss4e ? Also, should it be loaded before or after
gb4e ? I've discovered that gb4e usually needs to be loaded last or it causes problems. Garrett Mar
27 '12 at 14:23
Yes. You should load it after gb4e . And yes, gb4e should be loaded almost last since it messes with the
category codes of _ and ^ . Alan Munn Mar 27 '12 at 14:27
add a comment
You can also just put the language label between the \ex and \gll commands:
\begin{exe}
\ex Hungarian (Finn-Ugric, \emph{reference}) \gll
John house.his\\
\glt
`John's house'
\end{exe}
share improve this answer
J\'anos h\'aza\\
add a comment
Here's a (rather ugly) solution by wrapping the language label in an un-numbered example via \sn :
\newcommand\langlabel[1]{\sn\hspace*{-\leftmargin}{#1}\\[-1em]}
...
\begin{exe}
\langlabel{Hungarian (Finn-Ugric, \emph{reference})}
\ex \gll
J\'anos h\'aza\\
John house.his\\
\glt
`John's house'
\end{exe}
pdfcrowd.com
15
29
add a comment
I realize this is an old question, but for posterity's sake, I thought I'd point out that expex provides
several ways to include language name or other example annotations.
pdfcrowd.com
Explanation
Use \rightcomment{} between \gla and the first word. See section 11.2 of the expex
documentation.
Code
\documentclass{article}
\usepackage{expex}
\lingset{everygla=, belowglpreambleskip=-0.5ex, aboveglftskip=-0.5ex} % gloss formatting
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\ex
\begingl
\gla\rightcomment{Hungarian (Finno-Ugric, \emph{reference})}J\'anos h\'aza//
\glb John house.his//
\glft `John's house'//
\endgl
\xe
\lipsum[3]
\end{document}
pdfcrowd.com
Explanation
Use \glpreamble to introduce the preamble line above the first gloss line. Formatting of the gloss
preamble line can be controlled globally or locally by the parameter everyglpreamble . The vertical
space between the gloss preamble and the first gloss line can be controlled by the parameter
belowglpreambleskip . See section 9 of the expex documentation.
Code
\documentclass{article}
\usepackage{expex}
\lingset{everygla=, belowglpreambleskip=-0.5ex, aboveglftskip=-0.5ex} % gloss formatting
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\ex
\begingl
\glpreamble Hungarian (Finno-Ugric, \emph{reference})//
\gla J\'anos h\'aza //
\glb John house.his//
\glft `John's house' //
\endgl
\xe
pdfcrowd.com
\lipsum[3]
\end{document}
Explanation
expex doesn't provide a special command for this format, but it's still pretty simple to produce. The
code below creates a command \langlabel that removes the paragraph indent and adds the
vertical space that normally appears above examples. It then uses \ex~ instead of \ex so that
there is no vertical space between the label and the example.
By default, example numbers produced by expex are flush with the left margin (unlike in gb4e ,
where they are indented). If you want to indent the example numbers in expex , use the parameter
numoffset . See sections 4 and 5 of the expex documentation.
Code
\documentclass{article}
\usepackage{expex}
\newlength{\aboveexskip} % creates a length \aboveexskip
\setlength{\aboveexskip}{2.7ex plus .4ex minus .4ex} % sets a value for \aboveexskip (this the default value for vertical s
\lingset{aboveexskip=\aboveexskip, everygla=, belowglpreambleskip=-0.5ex, aboveglftskip=-0.5ex} % gloss formatting, aboveex
\newcommand{\langlabel}[1]{\vspace{\aboveexskip}\noindent{#1}} % \aboveexskip is used here because \ex~ will remove the ver
pdfcrowd.com
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\langlabel{Hungarian (Finno-Ugric, \emph{reference})}
\ex~ % use the ~ version with \langlabel unless you want vertical space between the label and the example
\begingl
\gla J\'anos h\'aza //
\glb John house.his//
\glft `John's house' //
\endgl
\xe
\lipsum[3]
\end{document}
share improve this answer
19
add a comment
Whilst this doesn't answer the OP's specific question, it relates to the same issue as in the question
title.
If you use linguex then I think the best solution is to simply place the \hfill Language info
after the translation line, which of course aligns your language info to the last line of your glossed
example, but this avoids far worse problems.
\documentclass{article}
\usepackage{linguex}
\begin{document}
\exg. Gianni teme questo.\\
Gianni fears this\\
pdfcrowd.com
The problem with all of the above solutions for people who already use linguex is that
1. you have to modify linguex.sty as per Daniel Bring's response above and/or download and
install cgloss as all the previous answers suggest, and more importantly
2. you'll have to modify the way you write ALL your linguex glossed examples to include \glt at
the beginning of the translation line. I use \exg. all the time and don't always need extra info
right aligned alongside it so I don't want to re-write all of my examples according to what the
cgloss package requires.
share improve this answer
add a comment
If you're using linguex , you might encounter an error if you use Alan's method from answer #1
above. I had to replace l.361--63 of linguex.sty ,...
\def\gl@stop{{\hskip -\glossglue}\unhbox\gline\end{flushleft}%
\global\glossfalse%
\ifindex\expandafter\lookforwords\fi {} }
pdfcrowd.com
The reason was that cgloss redefines \gl@stop , but then linguex re-re-defines it. The changes
above avoid that problem by combining both re-definitions.
In addition, replace line 34 in linguex.sty ...
\RequirePackage{xspace,cgloss4e}
...by...
\RequirePackage{xspace,cgloss}
99
177
Welcome to TeX.sx! You can add highlighting of code by selecting it and hitting Ctrl + K (or click the button
marked {} above the answer field. Blocks are indented by four spaces, inline code placed between
backticks ( ` ). Torbjrn T. Jan 22 '14 at 15:30
add a comment
Your Answer
pdfcrowd.com
Sign up or log in
Post as a guest
Name
Not the answer you're looking for? Browse other questions tagged { linguistics}
{ gb4 e } { cgloss4 e }
or ask
pdfcrowd.com
tour
help
blog
chat
data
legal
privacy policy
work here
TECHNOLOGY
Programmers
Server Fault
Web Applications
Ask Ubuntu
mobile
LIFE / ARTS
Stack Overflow
Super User
advertising info
Webmasters
Geographic
Information Systems
Game Development
Electrical Engineering
TeX - LaTeX
Android Enthusiasts
Information Security
Database
Administrators
Photography
contact us feedback
CULTURE /
RECREATION
English Language &
Usage
SCIENCE
OTHER
Mathematics
Stack Apps
Drupal Answers
SharePoint
Graphic Design
Mi Yodeya (Judaism)
Theoretical Computer
Science
User Experience
Seasoned Advice
(cooking)
Travel
Physics
Christianity
MathOverflow
Arqade (gaming)
more (7)
Mathematica
Salesforce
more (14)
Home Improvement
Skeptics
Bicycles
Academia
Role-playing Games
more (10)
more (21)
site design / logo 2015 stack exchange inc; user contributions licensed under cc by-sa 3.0 with attribution required
rev 2015.4.28.2540
pdfcrowd.com