5

I'm trying to use forest-GP1 which is a style in Zivanovic's forest-package (for phonological representation) found on github.

I have added the .sty file to the same directory as the relevant .tex file (I have also tried linking to it by defining the path in \usepackage{/path/forest-GP1}, but regardless I end up with the Missing \begin{document} error.

Here is the code I've used:

\documentclass{article}
\usepackage{forest-GP1}

\begin{document}

\begin{forest} GP1 [
[O[x[f ] ][x[r ] ] ]
[R[N[x[o ] ] ][x[s ] ] ]
[O[x[t ] ] ]
[R[N[x ] ] ]
]\end{forest}

\end{document}

I'm typesetting with PDFLaTeX in TeXWorks (using MiKTeX)

1

The reason is, that you are missing forest-GP1 package and it is not download automatically. Are you sure you included it in the right folder?

You could get it from github and include it in your working folder as forest-GP1.sty and it will work.

\documentclass{article}
\usepackage{forest-GP1}

\begin{document}

\begin{forest} GP1 [
[O[x[f ] ][x[r ] ] ]
[R[N[x[o ] ] ][x[s ] ] ]
[O[x[t ] ] ]
[R[N[x ] ] ]
]\end{forest}

\end{document}

enter image description here

  • The error should be different in this case, though... it will complain it cannot find the .sty file rather than about a missing \begin{document}. At least, that's the error I get... – cfr Apr 22 '15 at 12:46
  • You were right, it seems there was something wrong with the forest-GP1.sty I downloaded, I tried again by copy/pasting the forest-GP1 code, and now it works. Thank you. – Julian Ravn Lysvik Apr 24 '15 at 9:55
4

You could just define the style as show on page 49 of forest's manual:

\documentclass[tikz,border=5pt]{standalone}
\usepackage{forest}
\newbox\standardnodestrutbox
\setbox\standardnodestrutbox=\hbox to 0pt{\phantom{\forestOve{standard node}{content}}}
\def\standardnodestrut{\copy\standardnodestrutbox}
\forestset{% from page 49 of forest's manual
  GP1/.style 2 args={
    for n={1}{baseline},
    s sep=0pt, l sep=0pt,
    for descendants={
      l sep=0pt, l={#1},
      anchor=base,calign=first,child anchor=north,
      inner xsep=1pt,inner ysep=2pt,outer sep=0pt,s sep=0pt,
    },
    delay={
      if content={}{phantom}{for children={no edge}},
      for tree={
        if content={O}{tier=OR}{},
        if content={R}{tier=OR}{},
        if content={N}{tier=N}{},
        if content={x}{
          tier=x,content={$\times$},outer xsep={#2},
          for tree={calign=center},
          for descendants={content format={\standardnodestrut\forestoption{content}}},
          before drawing tree={outer xsep=0pt,delay={typeset node}},
          s sep=4pt
        }{},
      },
    },
    before drawing tree={where content={}{parent anchor=center,child anchor=center}{}},
  },
  GP1/.default={5ex}{8.0pt},
  associate/.style={%
    tikz+={\draw[densely dotted](!)--(!#1);}},
  spread/.style={
    before drawing tree={tikz+={\draw[dotted](!)--(!#1);}}},
  govern/.style={
    before drawing tree={tikz+={\draw[->](!)--(!#1);}}},
  p-govern/.style={
    before drawing tree={tikz+={\draw[->](.north) to[out=150,in=30] (!#1.north);}}},
  no p-govern/.style={
    before drawing tree={tikz+={\draw[->,loosely dashed](.north) to[out=150,in=30] (!#1.north);}}},
  encircle/.style={before drawing tree={circle,draw,inner sep=0pt}},
  fen/.style={pin={[font=\footnotesize,inner sep=1pt,pin edge=<-]10:\textsc{Fen}}},
  el/.style={content=\textsc{\textbf{##1}}},
  head/.style={content=\textsc{\textbf{\underline{##1}}}}
}

\begin{document}

  \begin{forest} GP1 [
    [O[x[f ] ][x[r ] ] ]
    [R[N[x[o ] ] ][x[s ] ] ]
    [O[x[t ] ] ]
    [R[N[x ] ] ]
    ]\end{forest}

\end{document}

GP1

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.