Upside-down syntax trees for linguistics with horizontal lines

Here’s a solution that uses the excellent forest package.

\documentclass[tikz,border=5pt]{standalone}
\usepackage{forest}

% Node shape adapted from http://www.texample.net/tikz/examples/data-flow-diagram/
\makeatletter \pgfdeclareshape{myunderline}{
  \inheritsavedanchors[from=rectangle]
  \inheritanchorborder[from=rectangle]
  \foreach \from in
    {center,base,north,north east,east,south east,south,south west,west,north west}{
      \inheritanchor[from=rectangle]{\from}
  }
  \backgroundpath{
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    % This can be improved by removing magic numbers
    \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya+1.75em}}
    \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya+1.75em}}
 }
} \makeatother

\begin{document}
\begin{forest}
for tree={
    fit=band, % Isolates space above this node from siblings’ descendants
    no edge,
    % Uncomment the line below for the dotted edges
    % edge={dotted, semithick, gray!50, shorten <=8pt}, parent anchor=north,
    % This can be improved by reducing space between levels where edges are drawn
    inner sep=0pt, outer sep=0pt,
    l sep=0pt, s sep=6pt, text depth=0.5em, grow'=north,
    where level=0{} % No style for dummy root node
      {where n children=0
        {font=\bfseries,tier=word} % Leaves in bold on the same tier
        {font=\small,tikz={\node[draw, thick, myunderline, fit to=tree] {};}} % Non-leaves
      }
}
% This can be improved by removing the need for a parent and sibling of the actual root
[,phantom[,phantom][OP
  [S/SN
    [Det [La] ]
    [N/Sust [novela] ]
    [CN/SAdj/Prop Sub Adj
      [PV/SV,
        [\textit{nexo} [que] ]
        [CI/SN [me] ]
        [N/V [ha regalado] ]
      ]
      [S/SN
        [Det [mi] ]
        [N [hermana] ]
      ]
    ]
  ]
  [PN/SV
    [N/V [est\'a] ]
    [Attrib/SAdj
      [N [ambientada] ]
    ]
    [CCL/SPrep
      [E [en] ]
      [T/SN
        [N [Australia\rlap.] ]
      ]
    ]
  ]
]]
\end{forest}
\end{document}

And here’s another version with faint dotted edges:

You can render the same structure in a more conventional appearance just by changing options:

for tree={
    edge={dotted, semithick, gray!80, shorten <=1pt,shorten >=3pt},
    parent anchor=south, child anchor=north,
    inner sep=0pt, outer ysep=2pt,
    text depth=0.5em,
    where n children=0{font=\bfseries,tier=word}{font=\small}
}

So you can see why one might prefer using forest instead of bussproofs or semantics. Also, the forest tree syntax is much simpler, and is not “backwards” as seen in cfr’s answer.

Take a look at the forest manual for more style options.

2019 edit: fit to tree option syntax has been modified to fit to=tree

2020 edit: changing l as l=1.5em changes the vertical spacing


For example:

\documentclass{standalone}
\usepackage[inference]{semantic}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\begin{document}

\setpremisesend{0pt}
\setpremisesspace{1pt}
\setnamespace{0pt}
\inference{%
  \inference{%
    \inference{\mbox{La}}{Det}
    &
    \inference{\mbox{novela}}{N/Sust}
    &
    \inference{%
      \inference{%
        \inference{\mbox{que}}{nexo}
        &
        \inference{\mbox{me}}{CI/SN}
        &
        \inference{\mbox{ha regalado}}{N/V}
      }
      {PV/SV}
      &
      \inference{%
        \inference{\mbox{mi}}{Det}
        &
        \inference{\mbox{hermana}}{N}
      }
      {S/SN}
    }
    {CN/SAdj/Prop. Sub. Adj}
  }
  {S/SN}
  &
  \inference{%
    \inference{\mbox{está}}{N/V}
    &
    \inference{%
      \inference{\mbox{ambientada}}{N}
    }
    {Attrib/SAdj}
    &
    \inference{%
      \inference{\mbox{en}}{E}
      &
      \inference{%
        \inference{\mbox{Australia}}{N}
      }
      {T/SN}
    }
    {CCL/SPrep}
  }
  {PN/SV}
}
{OP}

\end{document}

Tree


Here's a different way... based on my answer at Highlighting text through stacked colored underlines

\documentclass{article}
\usepackage{stackengine}
\newlength\tmpln
\newlength\lunderset
\newlength\rulethick
\lunderset=1\baselineskip\relax
\rulethick=.8pt\relax
\def\stackalignment{l}
\newcommand\nunderline[3][1]{\setbox0=\hbox{#2}\tmpln=\wd0%
  \stackunder[#1\lunderset-\rulethick]{\strut#2}{%
     \smash{\raisebox{-.6\baselineskip}{\makebox[0pt][l]{\scriptsize #3}}}%
     \rule{\tmpln}{\rulethick}}}%
\let\Nun\nunderline
\let\HS\hspace
\begin{document}
          \Nun{\Nun{\Nun[3]{La}{Det}}{}}{}%
               \Nun{\Nun[4]{ }{}}{}%
          \Nun{\Nun{\Nun[3]{novela}{N/Sust}}{}}{}%
               \Nun{\Nun[4]{ }{}}{}%
\Nun{\Nun{\Nun{\Nun{\Nun   {que}{\itshape nexo}}{}}{}}{}}{}%
     \Nun{\Nun{\Nun{\Nun[2]{ }{}}{}}{}}{}%
\Nun{\Nun{\Nun{\Nun{\Nun   {me}{CI/SN}}{}}{}}{}}{}%
     \Nun{\Nun{\Nun{\Nun[2]{ }{PV/SV}}{CN/SAdj/Prop. Sub. Adj}}{S/SN}}{}%
\Nun{\Nun{\Nun{\Nun{\Nun   {ha}{}}{}}{}}{}}{}%
\Nun{\Nun{\Nun{\Nun{\Nun   { }{}}{}}{}}{}}{}%
\Nun{\Nun{\Nun{\Nun{\Nun   {regalado}{N/V}}{}}{}}{}}{}%
          \Nun{\Nun{\Nun[3]{ }{}}{}}{}%
\Nun{\Nun{\Nun{\Nun{\Nun   {mi}{Det}}{}}{}}{}}{}%
     \Nun{\Nun{\Nun{\Nun[2]{ }{}}{}}{}}{}%
\Nun{\Nun{\Nun{\Nun{\Nun   {hermana}{\HS{5ex}N}}{S/SN}}{}}{}}{OP}%
                    \Nun[5]{ }{}%
          \Nun{\Nun{\Nun[3]{est\'a}{N/V}}{}}{}%
               \Nun{\Nun[4]{ }{}}{}%
     \Nun{\Nun{\Nun{\Nun[2]{ambientada}{\HS{7ex}N}}{Attrib/SAdj}}{\HS{7ex}PN/SV}}{}%
               \Nun{\Nun[4]{ }{}}{}%
     \Nun{\Nun{\Nun{\Nun[2]{en}{E}}{\HS{4ex}CCL/SPrep}}{}}{}%
          \Nun{\Nun{\Nun[3]{ }{}}{}}{}%
\Nun{\Nun{\Nun{\Nun{\Nun   {Australia}{\HS{6ex}N}}{\HS{3ex}T/SN}}{}}{}}{}%
\end{document}

enter image description here