tex stackexchange com questions 49579 labeling linguistic ex

14
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API Take the 2-minute tour × 8 2 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: Language (family, citation, etc.) (1) example text glosses 'translation' 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} Answer the Unanswered in 4 days asked 3 years ago viewed 1743 times active 2 months ago Upcoming Events 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. Labeling linguistic examples with language information sign up log in tour help search Questions Tags Users Badges Unanswered Ask Question

Upload: mrnogood

Post on 12-Nov-2015

57 views

Category:

Documents


0 download

DESCRIPTION

texling

TRANSCRIPT

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    Take the 2-minute tour

    8

    2

    I'm writing a linguistics paper that uses a large amount of linguistic examples from a wide variety oflanguages, using the gb4e package. I want to be able to label each example with information about thelanguage it comes from, as I've seen in some texts, sort of like this:

    Language (family, citation, etc.)

    (1) example text

    glosses

    'translation'

    gb4e is great at formatting the examples themselves, but I can't seem to get the label placed where Iwant it, that is, placed immediately before the example and without an indent. Here's some examplecode:

    \documentclass{article}

    \usepackage{gb4e}

    \usepackage{lipsum}

    Answer the Unansweredin 4 days

    asked 3 years ago

    viewed 1743 times

    active 2 months ago

    Upcoming Events

    TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesettingsystems. It's 100% free, no registration required.

    Labeling linguistic examples with language information

    sign up

    log in

    tour

    help

    search

    Questions Tags Users Badges Unanswered Ask Question

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    Alan Munn92k 14 245 403

    Garrett43 4

    6 Answers active oldest votes

    \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}

    \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 itinside, it gives me an error. How can I make it look the way I want? I've looked at other packages thatdo numbered examples, but they don't seem to have solutions either, and they also don't have thesame functionality as gb4e that I need.

    Any help would be greatly appreciated.

    {linguistics } {gb4e} {cgloss4e}

    share improve this question edited Nov 16 '13 at 5:26 asked Mar 27 '12 at 2:22

    1 I have edited your question to include lipsum package for introducing dummy text for better readability andfocus, you can also use egreg's kantlipsum package for the same purpose. Please rollback if this is notdesired. percusse Mar 27 '12 at 3:19

    Didn't even know those existed. Thank you! Garrett Mar 27 '12 at 14:07

    If you use Alexis Dimitriadis' version of cgloss4e available here as cgloss.sty you can put

    Get the weekly newsletter!

    Top questions and answers

    Important announcements

    Unanswered questions

    Sign up for the newsletter

    see an example newsletter

    Linked

    1 How do I right-align text in aglossed Linguex example?

    3 Beamer, philex and \hfill

    10 Which packages should Irecommend to postgraduatesin different academicdisciplines?

    0 How to get a first unglossedline with linguex

    Related

    10 Section based linguisticexample numbering withbrackets

    2 Restate linguistic example

    add a comment

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    12

    language information right aligned with the first line of the example. This is IMO a very nice way toformat 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}

    Solution also works with linguex

    Another popular package for formatting linguistic examples is the linguex package. Since linguex also uses cgloss4e , the solution given above will also work. Here's the same example

    using the linguex commands:

    \documentclass{article}

    \usepackage{linguex}

    \usepackage{cgloss}

    \usepackage{lipsum}

    \begin{document}

    \lipsum[2]

    \exg.

    J\'anos h\'aza\\

    John house.his\\ \hfill Hungarian (Finno-Ugric, \emph{reference})

    0 How can I label an interlineargloss in gb4e?

    1 How can I label a numberedinterlinear gloss in gb4e?

    3 Example using gb4e withoutgloss line

    5 Align glosses in more thanone language with gb4e

    4 Unnumbered linguisticexamples with glosses

    4 How to bold (\textbf) an entireexample in gb4e?

    5 Remove parenthesis (andadd period) from gb4eexamples

    2 Linguistics: what are the bestpackages to use createbracketed structures withmovement lines?

    Hot Network Questions

    Is there a word or an idiom forpeople who only spend theirfamilies' money and fool around?

    Does average lifetime even meananything?

    What are the Little Ones?

    Are the "fine inks" a wizard needs tocopy a spell the same as the "rareinks" a warlock needs to copy aritual?

    Can I delete an entire line, exceptthe line break?

    Different CDF Notations

    'Male'/'female' is to 'gender' as 'left-handed'/'right-handed 'is to...?

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    Alan Munn92k 14 245 403

    \glt `John's house'

    \lipsum[3]

    \end{document}

    share improve this answer edited Aug 28 '13 at 21:37 answered Mar 27 '12 at 3:48

    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 gb4edistribution. You don't see it because you usually never load it by itself. cgloss is a replacement for

    Java 8 way to work with an enum

    Is there any disadvantage tosending rockets straight up?

    sed to delete lines using multiplesearch string

    Can a US citizen entering E.U. inGermany travel through Switzerlandwithout further ado?

    Find the composite poison in thewine bottles

    How often are results faked incomputer science papers?

    If transitioning into academicposition, should I buy my PhDgraduation cap and gown?

    How to simplify repeating if-then-assign construction?

    Turing Machine that computesmaximum steps of haltingmachines

    Why was converting Luke to the darkside worth the Emperor's life?

    I had one job to do

    Where do you pick up on a classafter taking a prestige class?

    Should I do many shallow quickcuts or a single deep slow one withmy router?

    How do you make a cluster of cubesexplode?

    Why were Space Shuttle astronautsable to walk off the orbiter?

    suspended with pay -- meaning?

    Area of an ASCII polygon

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    cbowern96 4

    cgloss4e not for gb4e itself. But yes, it works identically as far as I know. I'm not sure why Alexis hasnever 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 aftergb4e ? I've discovered that gb4e usually needs to be loaded last or it causes problems. Garrett Mar

    27 '12 at 14:23

    1 Yes. You should load it after gb4e . And yes, gb4e should be loaded almost last since it messes with thecategory codes of _ and ^ . Alan Munn Mar 27 '12 at 14:27

    4

    You can also just put the language label between the \ex and \gll commands:

    \begin{exe}

    \ex Hungarian (Finn-Ugric, \emph{reference}) \gll J\'anos h\'aza\\

    John house.his\\

    \glt `John's house'

    \end{exe}

    share improve this answer answered Oct 23 '13 at 14:50

    3

    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}

    add a comment

    add a comment

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    LianTze Lim4,211 1 15 29

    share improve this answer edited Mar 27 '12 at 4:03 answered Mar 27 '12 at 3:35

    2

    I realize this is an old question, but for posterity's sake, I thought I'd point out that expex providesseveral ways to include language name or other example annotations.

    Right-aligned, on first gloss line

    This is the format suggested in the answer by @Alan Munn:

    add a comment

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    Explanation

    Use \rightcomment{} between \gla and the first word. See section 11.2 of the expexdocumentation.

    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}

    Within example, above gloss lines

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    This is the format suggested in the answer by @cbowern:

    Explanation

    Use \glpreamble to introduce the preamble line above the first gloss line. Formatting of the glosspreamble line can be controlled globally or locally by the parameter everyglpreamble . The verticalspace 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.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    \lipsum[3]

    \end{document}

    Left-aligned, above the example

    This is the format suggested in the original question:

    Explanation

    expex doesn't provide a special command for this format, but it's still pretty simple to produce. Thecode below creates a command \langlabel that removes the paragraph indent and adds thevertical space that normally appears above examples. It then uses \ex~ instead of \ex so thatthere 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 space above examples taken from the expex documentation)

    \lingset{aboveexskip=\aboveexskip, everygla=, belowglpreambleskip=-0.5ex, aboveglftskip=-0.5ex} % gloss formatting, aboveexskip=\aboveexskip sets the expex parameter aboveexskip to the length specified in the line above

    \newcommand{\langlabel}[1]{\vspace{\aboveexskip}\noindent{#1}} % \aboveexskip is used here because \ex~ will remove the vertical spacing above the example

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    Jason Zentz1,227 3 19

    \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 edited Nov 14 '14 at 15:38 answered Nov 10 '14 at 15:28

    1

    Whilst this doesn't answer the OP's specific question, it relates to the same issue as in the questiontitle.

    If you use linguex then I think the best solution is to simply place the \hfill Language infoafter the translation line, which of course aligns your language info to the last line of your glossedexample, but this avoids far worse problems.

    \documentclass{article}

    \usepackage{linguex}

    \begin{document}

    \exg. Gianni teme questo.\\

    Gianni fears this\\

    add a comment

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    Laua31 5

    `Gianni fears this' \hfill Experiencer subjects

    \end{document}

    Which looks like this:

    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 andinstall 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 atthe beginning of the translation line. I use \exg. all the time and don't always need extra inforight 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 answered Feb 23 at 16:48

    0

    If you're using linguex , you might encounter an error if you use Alan's method from answer #1above. 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 {} }

    ...with the following:

    \def\gl@stop{{\hskip -\glossglue}\unhbox\gline\leavevmode \egroup

    \global\glossfalse%

    \ifindex\expandafter\lookforwords\fi {} }

    add a comment

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    Torbjrn T.50k 4 99 177

    Daniel Bring1

    The reason was that cgloss redefines \gl@stop , but then linguex re-re-defines it. The changesabove avoid that problem by combining both re-definitions.

    In addition, replace line 34 in linguex.sty ...

    \RequirePackage{xspace,cgloss4e}

    ...by...

    \RequirePackage{xspace,cgloss}

    ...and linguex loads cgloss , so you don't have to call it seperately.

    It works fine on my installation.

    share improve this answer edited Jan 22 '14 at 15:18 answered Jan 22 '14 at 15:12

    2 Welcome to TeX.sx! You can add highlighting of code by selecting it and hitting Ctrl + K (or click the buttonmarked {} above the answer field. Blocks are indented by four spaces, inline code placed betweenbackticks ( ` ). Torbjrn T. Jan 22 '14 at 15:30

    Your Answer

    add a comment

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    Post Your Answer

    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 { linguistics} { gb4e} { cgloss4e} or ask

    your own question.

    question feed

    Post as a guest

    Name

    Email

    required, but never shown

    Sign up or log in

    Sign up using Google

    Sign up using Facebook

    Sign up using Stack Exchange

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback

    TECHNOLOGY LIFE / ARTS CULTURE /RECREATION

    SCIENCE OTHER

    Stack Overflow

    Server Fault

    Super User

    Web Applications

    Ask Ubuntu

    Webmasters

    Game Development

    TeX - LaTeX

    Programmers

    Unix & Linux

    Ask Different (Apple)

    WordPressDevelopment

    GeographicInformation Systems

    Electrical Engineering

    Android Enthusiasts

    Information Security

    DatabaseAdministrators

    Drupal Answers

    SharePoint

    User Experience

    Mathematica

    Salesforce

    more (14)

    Photography

    Science Fiction &Fantasy

    Graphic Design

    Seasoned Advice(cooking)

    Home Improvement

    Personal Finance &Money

    Academia

    more (10)

    English Language &Usage

    Skeptics

    Mi Yodeya (Judaism)

    Travel

    Christianity

    Arqade (gaming)

    Bicycles

    Role-playing Games

    more (21)

    Mathematics

    Cross Validated (stats)

    Theoretical ComputerScience

    Physics

    MathOverflow

    more (7)

    Stack Apps

    Meta Stack Exchange

    Area 51

    Stack Overflow Careers

    site design / logo 2015 stack exchange inc; user contributions licensed under cc by-sa 3.0 with attribution required

    rev 2015.4.28.2540