5

I am using gb4e and tikz-dependency simultaneously to demonstrate dependency examples with my glossed sentences. But if my example sentence is too long, it doesn't get split across lines and just goes off the margins. It looks really bad, and I feel like there has to be a way to position the dependency example better, like narrow down the margins or turn off the indent, flush left or anything else.

I'm new to LaTeX and I welcome any comments :)

Thank you!

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\setlength\parindent{0.25in}
\bibliographystyle{chicago}
\usepackage{natbib}
\usepackage[english]{babel}
\newcommand{\itab}[1]{\hspace{0em}\rlap{#1}}
\newcommand{\tab}[1]{\hspace{.2\textwidth}\rlap{#1}}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{indentfirst}
\usepackage{hyperref}
\usepackage{tikz-dependency}
\usepackage{gb4e}

\begin{document}
\begin{exe}
\ex{Con20.019 - Parallel roots and shared arguments}\\ 
\begin{dependency}[theme = simple]
\begin{deptext}
 Nehe' \& nebesiiwoho' \& nihP \& how3o'uuni \& nono'eiP \& hih'oownih'oo3ouyeitino', \&      nihbeexo'uunono'eitisi3i'.\\
\end{deptext}
\depedge{1}{2}{\textsc{det}}
\depedge{2}{6}{\textsc{sbjct.pp}}
\depedge[arc angle = 20, edge below]{2}{7}{\textsc{agent.pp}}
\depedge{3}{6}{\textsc{repr}}
\depedge{4}{6}{\textsc{skip}}
\depedge{5}{6}{\textsc{repr}}
\deproot{6}{\textsc{root}}
\depedge{7}{6}{\textsc{rootp}}
\end{dependency}
\glll
 nehe' ne-besiiwoho' nih-P how3o'-uuni {nono'eiti-P} {hih'oow-nih'oo3ouyeiti-no’} {nih-beexo'u-unono'eitis-i3i’}\\
 this 1S-grandfathers  PAST-pause/break never-DETACH {speak Arapaho-pause/break} {3.PAST.NEG-speak English-pers.PL} {PAST-only-speak Arapaho to-3PL/1S}\\
 det infl-na.oblposs.pl prefix-P prefix-deriv {vai-P} {infl+prefix-vai.incorp-infl} {prefix-prefix-vta.incorp.1S-infl}\\
\trans ``My grandfathers never spoke English, they only spoke Arapaho to me.''
\end{exe}
\end{document}

Long sentence

6

Here are some steps you can take to alleviate this problem. You can combine them as you wish to meet your needs:

  • Reduce the margins. You are already using geometry to set your margins to 1 inch. You can reduce this for all the margins using the margin key you're already using, but geometry also provides keys for setting the horizontal and vertical margins separately (e.g., \usepackage[vmargin=1in, hmargin=0.75in]{geometry}.
  • Eliminate the indent before the example number. Put \exewidth{(\thexnumi)} in your preamble. (See this answer by Alan Munn).
  • Hyphenate long words. You can simply add another line to your deptext environment and split long words onto two lines (see section 3 of the tikz-dependency documentation, as well as my example below). You can add as many lines as you'd like.
  • Reduce the font size. To change the size of the nodes but not the size of the labels on the arrows, pass the font option to the deptext environment. For example, \begin{deptext}[font=\scriptsize] will make the node text scriptsize but keep the label text the same as before.
  • Scale the graph down. This will reduce the font size of all the text, including labels, as well as reduce the size of the arrows. For example, use \scalebox{0.7}{\begin{dependency}...\end{dependency}} to scale the whole graph down by 30%, keeping the original proportions. This is a graphicx command; graphicx is loaded by tikz, which is loaded by tikz-dependency, so you don't need to add anything to your preamble to use this.

Example 1

In the example below, I've eliminated the indentation before the example number and hyphenated some of the longer words (following the morpheme boundaries in your glosses). I've added the showframe package to show that this makes the graph fit within the 1-inch margins you had specified.

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\setlength\parindent{0.25in}
\bibliographystyle{chicago}
\usepackage{natbib}
\usepackage[english]{babel}
\newcommand{\itab}[1]{\hspace{0em}\rlap{#1}}
\newcommand{\tab}[1]{\hspace{.2\textwidth}\rlap{#1}}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{indentfirst}
\usepackage{hyperref}
\usepackage{tikz-dependency}
\usepackage{gb4e}
\exewidth{(\thexnumi)} % as suggested by Alan Munn at http://permalink.gmane.org/gmane.comp.tex.linguistics/1610
\usepackage{showframe} % used to show margin lines

\begin{document}
\begin{exe}
\ex{Con20.019 - Parallel roots and shared arguments}\\ 
\begin{dependency}[theme = simple]
\begin{deptext}
 Nehe' \& nebesiiwoho' \& nihP \& how3o'- \& nono'eiP \& hih'oow- \& nihbeexo'u-\\
\& \& \& uuni \& \& nih'oo3ouyeitino', \& unono'eitisi3i'. \\
\end{deptext}
\depedge{1}{2}{\textsc{det}}
\depedge{2}{6}{\textsc{sbjct.pp}}
\depedge[arc angle = 20, edge below]{2}{7}{\textsc{agent.pp}}
\depedge{3}{6}{\textsc{repr}}
\depedge{4}{6}{\textsc{skip}}
\depedge{5}{6}{\textsc{repr}}
\deproot{6}{\textsc{root}}
\depedge{7}{6}{\textsc{rootp}}
\end{dependency}
\glll
 nehe' ne-besiiwoho' nih-P how3o'-uuni {nono'eiti-P} {hih'oow-nih'oo3ouyeiti-no’} {nih-beexo'u-unono'eitis-i3i’}\\
 this 1S-grandfathers  PAST-pause/break never-DETACH {speak Arapaho-pause/break} {3.PAST.NEG-speak English-pers.PL} {PAST-only-speak Arapaho to-3PL/1S}\\
 det infl-na.oblposs.pl prefix-P prefix-deriv {vai-P} {infl+prefix-vai.incorp-infl} {prefix-prefix-vta.incorp.1S-infl}\\
\trans ``My grandfathers never spoke English, they only spoke Arapaho to me.''
\end{exe}
\end{document}

enter image description here

Example 2

In this example, I've reduced the horizontal margins to 0.75 inches and reduced the size of the node text to footnotesize.

\documentclass[12pt]{article}
\usepackage[vmargin=1in, hmargin=0.75in]{geometry}
\setlength\parindent{0.25in}
\bibliographystyle{chicago}
\usepackage{natbib}
\usepackage[english]{babel}
\newcommand{\itab}[1]{\hspace{0em}\rlap{#1}}
\newcommand{\tab}[1]{\hspace{.2\textwidth}\rlap{#1}}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{indentfirst}
\usepackage{hyperref}
\usepackage{tikz-dependency}
\usepackage{gb4e}
\usepackage{showframe} % used to show margin lines

\begin{document}
\begin{exe}
\ex{Con20.019 - Parallel roots and shared arguments}\\ 
\begin{dependency}[theme = simple]
\begin{deptext}[font=\footnotesize]
 Nehe' \& nebesiiwoho' \& nihP \& how3o'uuni \& nono'eiP \& hih'oownih'oo3ouyeitino', \&      nihbeexo'uunono'eitisi3i'.\\
\end{deptext}
\depedge{1}{2}{\textsc{det}}
\depedge{2}{6}{\textsc{sbjct.pp}}
\depedge[arc angle = 20, edge below]{2}{7}{\textsc{agent.pp}}
\depedge{3}{6}{\textsc{repr}}
\depedge{4}{6}{\textsc{skip}}
\depedge{5}{6}{\textsc{repr}}
\deproot{6}{\textsc{root}}
\depedge{7}{6}{\textsc{rootp}}
\end{dependency}
\glll
 nehe' ne-besiiwoho' nih-P how3o'-uuni {nono'eiti-P} {hih'oow-nih'oo3ouyeiti-no’} {nih-beexo'u-unono'eitis-i3i’}\\
 this 1S-grandfathers  PAST-pause/break never-DETACH {speak Arapaho-pause/break} {3.PAST.NEG-speak English-pers.PL} {PAST-only-speak Arapaho to-3PL/1S}\\
 det infl-na.oblposs.pl prefix-P prefix-deriv {vai-P} {infl+prefix-vai.incorp-infl} {prefix-prefix-vta.incorp.1S-infl}\\
\trans ``My grandfathers never spoke English, they only spoke Arapaho to me.''
\end{exe}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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