I want to make up some handouts on sentence diagramming. For those who didn't have to diagram sentences at school, I'm talking about something like this.

enter image description here

It's basically an exploded view of the sentence, with the various parts all laid out in relation to each other. I would post some sample code for people to comment on, but I'm not even sure where to start with this. I'm putting the tikz tag on the question, but I don't even know whether tikz is the right tool for the job. Where should I start figuring this out?

(I did find this earlier post, but it doesn't really get at the branching &c. in the link above.)

  • 1
    I don't think the linguists' packages are likely to help here - none I've seen, anyway. (But I'm not a linguist.) So probably tikz or a similar content-agnostic approach is your only option. Unless someone else knows of something more specialised. The trouble is, there isn't really any pattern to the diagram as far as I can tell. Or there is, but it is an irregular and quirky one rather than a standard format.
    – cfr
    Jun 4, 2014 at 1:46
  • 1
    That's the thing: there is a system, but it's clunky.
    – crmdgn
    Jun 4, 2014 at 10:10
  • 2
    Suppose I wanted to write a package for this. How hard would that be (in the world of package-writing)?
    – crmdgn
    Jun 4, 2014 at 11:01
  • 2
    Please see revision. Jun 4, 2014 at 15:28
  • 4
    While it's possible that many people dislike grammar, I think a more telling reason is that this peculiarly American way of diagramming sentences isn't used in any scientific representation of language; there are better methods for representing structure (such as regular trees) and so interest in this notation for linguists is at best one of a curiosity of times past.
    – Alan Munn
    Jun 4, 2014 at 16:43

1 Answer 1



Macros available to use:

\startline[indent] draws the top startline, with optional indent.

\xdiv vertical line that crosses the startline, as between "puzzles" and "are" in the MWE.

\vdiv vertical line that does not cross the underline, as between "exercising" and "mind" in the MWE.

\ddiv diagonal line that does not cross the startline, as between "are" and "games" in the MWE.

\diag[mode]{diag-dimen}{diagtext}{horiz-dimen}{horiz-text} drops a diagonal that will vertically extend diagdimen\baselineskip downward, places the diag text over it, then draws a line of length horiz-dimen\baselineskip and set the horiz-text above it (by default). If the mode is set to [d], the horizontal line is dashed and the horiz-text is underset, like the word "yet" in the MWE. If the mode is [b], the diagonal is blanked out, as with the word "exercising" in the MWE.

\dropleg[mode]{dimen}{left-aligned underset} Drops a vertical strut of height dimen\baselineskip and then sets the final argument to the right of that. If mode is [d], the strut is dashed, as shown below "are" in the MWE.

\entry{dimen}{text}{aftercode} a self-contained underlined entry, such as "and" in the MWE. The text is centered and underlined by a line of length dimen\baselineskip, and the aftercode is executed at the right hand end of the underline.

\tstrut{dimen} the trianglular shape with a vertical strut above, as seen below "exercising" in the MWE. The height of the \tstrut object is determined by the number dimen, which is a multiple of \baselineskip, which should be the difference between the depths of two adjacent \diags.

\leftstep the stair-step thingie that is left-lapped.


\rlwd rule width; (.5pt) default.

\tlength the step height and the triangular leg length, both below "exercising" in the MWE; 1.7ex default.

In the MWE, you will note that horizontal space had to be added manually between entries. Also, to create the 2nd line, I left the \dropleg below "and" dangling, and used \vspace to shift to the lower position. The argument to \vspace (16\baselineskip) was easily ascertained, because the \droplegs before and after "and" were both of dimen=8. The \tstrut dimen of 2 is also easily ascertained, since the dimen of the "for" \diag was 6, while the dimen of "exercising" \diag was 4, the difference being 2.

To drop a \diag in the middle of a word, you have two options (both shown in the MWE):

1) split the word around the diag, like newspa\diag{2}{in}{5}{America}pers, or

2) place the word in a box of smaller width than its actual width, such as \makebox[3ex]{\textcolor{blue}{puzzles}}\diag{4.5}{crossword}{}{}.

In either case, you will generally follow the word with some \hspace.

Since I could not create a curved arc, the "Appearing" leg is done with a \dropleg with a \diag as the underset code.

% Based on morsburg at http://tex.stackexchange.com/questions/12537/
% how-can-i-make-a-horizontal-dashed-line/12553#12553
\def\dashfill{\cleaders\hbox to .6em{\rule{1ex}{\rlwd}}\hfill}
\newcommand\dashline[1]{\hbox to #1{\dashfill\hfil}}
  }{\rule{\rlwd}{\dimexpr #1\baselineskip-.7071\tlength}}}}%
    \if d#1%
  \if b#1\def\dcolor{white}\else\def\dcolor{black}\fi%
      \if d#1%


enter image description here

  • 1
    The traditional format is pretty rigid. I don't know whether adherence to tradition matters, since the whole practice is out of fashion these days, but the basic idea is to create a visual representation of how the words in the sentence relate to each other (so, e.g., the angled line between "are" and "games" means something different from the vertical line between "puzzles" and "are"). I imagine the next step is for me to catalogue all the relationships I would need to depict.
    – crmdgn
    Jun 4, 2014 at 13:38
  • 1
    @crmdgn This is fantastic. I have been looking for something like this for a while to do Greek syntax layouts. I tried to make my own, but failed. Are you planning on making this a package in CTAN?
    – Paul
    Oct 21, 2014 at 18:02
  • 2
    @Paul Thanks for the "like". Since my effort was focused on recreating an image provided by the OP, I don't feel I know enough on the protocols of sentence diagramming to call it a package. For one thing, what other necessary constructs are required? For another, I wouldn't know a correct from an incorrect diagram. With these limitations, I did not want to package it. But I am glad you find it useful, and would be happy to "support" what is already here, if I am able. Oct 21, 2014 at 18:47
  • 2
    That feel when the result obtained in the answer is nicer of what the OP wanted to achieve. :D
    – gvgramazio
    May 3, 2018 at 10:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .