Take the 2-minute tour ×
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.

I'm writing a document describing the semantics of opinion phrases in English, and in order to do so, I'm annotating particular spans of text as having particular semantic functions within the opinion. So far, my results look something like this (with the TeX code that typesets each one underneath).

Example #31

\enumsentence{
    \target{The Lost World}
    was a 
    \comparator{\attitude{better}}
    \superordinate[1]{book}
    \comparatorthan{than}
    \superordinate[2]{movie}.
}

Example #34

\enumsentence{
    \evaluator{I} thought
    \target[1]{they} were 
    \comparator{less} \attitude{controversial} \comparatorthan{than}
    \target[2]{the ones I mentioned above}.
}

Example #42

\enumsentence{
    \target{A real rav muvhak ends up knowing you very well,
    very intimately one might say} 
    - in a way that I am not sure is actually 
    \attitude{very appropriate} 
    or easy to negotiate 
    \aspect{when the sexes differ}.
}

The different annotation commands \target, \attitude, \aspect, \superordinate, and \comparatorthan are all defined to set the formatting to italic or bold-italic text, surround the text that's annotated in brackets and place the annotation name in subscript outside the brackets.

The problem is that I don't really like this notation. The subscript annotation names make it hard to easily identify the words in the sentence, and long annoation names have the tendency to cause overfull hboxes. Overlapping annotations are also not as nice as they could be.

So here's my request. Can you all think of more creative, nicer ways to present the same information?

Note: preferably I'd like to do this by only redefining the annotation commands (and not changing the commands found in the 100 or so examples that are in this document already). Also, annotations are supposed to overlap in some cases, like in example 31, so any solution needs to account for that. Also note that in example 42, one of the annotations has to wrap.

share|improve this question

4 Answers 4

There may be more than one solution. If I were you, I'd use backgroundcolors to mark annotations, e.g. yellow for target, green for comparator and so on. In case of overlapping annotations you'd have yellow background and green letters. You could print your definitions on every page into the margin.

In case you don't like colors, why not use negative print, a white "t" on a black circle as abrevation for "target"? Or, thinking of Linux Libertine, use the outline fonts to mark your text (cf. libertineOutline.pdf)?

Regards, Alexander

share|improve this answer
1  
Colors may not be appropriate depending on the medium. For instance, a journal article would probably not get published in different colors. Or if this notation is taught to students they shouldn't need to carry around multiple pens! –  Matthew Leingang May 11 '11 at 14:31
    
And now I'm thinking about annotating the first sentence in my last comment using the notation of this question! –  Matthew Leingang May 11 '11 at 14:32

I love this question and spent far too much time thinking about how to answer it. I think what you need are some good symbols to use in place of the annotations. Then you can subscript with them instead. Also, I think underlining rather than bracketing will set off the annotated text a little better.

I found a wavy underline under an \attitude made sense, and everything else a regular underline. Having graphed these comparison statements, it seems that the attitude is really the central thing in the statement. Also, if the attitude is included in the comparator as in better (which is our way of saying "more good"), the two decorations live together in peace.

For \target, I thought about a circle with a dot (like a target symbol). In the case of multiple targets, the optional argument can go inside the circle instead of the dot.

For \superordinate I thought a box looked nice, modified as \target in the case of an optional argument.

It seems that \comparator and \comparatorthan go hand in hand, and together denote a comparison, so I chose < for one and > for the other.

For \evaluator I chose a smiley to mean a person, but any symbol indicating an “agent” could work.

For \aspect I originally had ? because the aspect seems to be the answer to a question like when? or how? Then I changed it to * because of it use in footnotes to make a qualification.

I don't have to change the interface you've already used. Here's my implementation:

\documentclass{article}
% TEX.SE \url{http://tex.stackexchange.com/q/17913/1402}
\usepackage{ulem}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{mathabx}
\usepackage{wasysym}

\newdimen\supsymwidth
\newdimen\supsymheight
\newdimen\tgtsymwidth
\setbox0=\hbox{$_\bigboxvoid$}
\supsymwidth=\wd0
\supsymheight=\ht0
\setbox0=\hbox{$_\bigovoid$}
\tgtsymwidth=\wd0

\newcommand{\supsym}[1]{%
  \mathrlap{\bigboxvoid}
  \raisebox{0.5pt}{\hbox to \supsymwidth{\hfill{\tiny#1}\hfill}}
}

\newcommand{\tgtsym}[1]{
  \mathrlap{\bigovoid}
  \raisebox{0.5pt}{\hbox to \supsymwidth{\hfill{\tiny#1}\hfill}}
}

\newcommand{\enumsentence}[1]{\begin{quotation}#1\end{quotation}}
\newcommand{\evaluator}[1]{\uline{#1}$_{\smiley}$}
\newcommand{\target}[2][\relax]{\uline{#2}$_{\ifx#1\relax\bigodot\else\tgtsym{#1}\fi}$}
\newcommand{\comparator}[1]{#1$_{<}$}
\newcommand{\comparatorthan}[1]{#1$_{>}$}
\newcommand{\superordinate}[2][\relax]{#2$_{\ifx#1\relax\bigovoid\else\supsym{#1}\fi}$}
\newcommand{\attitude}[1]{\uwave{#1}}
\newcommand{\aspect}[1]{\uline{#1}$_{\ast}$}

\begin{document}

\enumsentence{
    \target{The Lost World}
    was a 
    \comparator{\attitude{better}}
    \superordinate[1]{book}
    \comparatorthan{than}
    \superordinate[2]{movie}.
}

\enumsentence{
    \evaluator{I} thought
    \target[1]{they} were 
    \comparator{less} \attitude{controversial} \comparatorthan{than}
    \target[2]{the ones I mentioned above}.
}

\enumsentence{
    \target{A real rav muvhak ends up knowing you very well,
    very intimately one might say}---in a way that I am not sure is actually 
    \attitude{very appropriate} 
    or easy to negotiate 
    \aspect{when the sexes differ}.
}

\end{document}

sample code output

I've also thought about using tikz to graph these opinion phrases, but that's not what you asked for. Maybe another answer at another time. :-)

share|improve this answer
2  
Note that the current solution is deliberately tikz-free. –  Matthew Leingang May 11 '11 at 13:53
    
I like the underline suggestion, and the ulem suggestion, but once I started looking at the ulem package, I decided to take this in a totally different direction. –  Ken Bloom May 11 '11 at 15:09
    
@Ken Bloom: Are you thinking about using different kinds of underlines? –  Matthew Leingang May 11 '11 at 15:15
    
Well, I really want to the names of the annotations there (instead of replacing them with a less self-explanatory notation), but the fact that you introduced me to ulem, helped me to make underlines that wrap, and I also got to see that \underline stacks. I'm posting my solution as an answer now. –  Ken Bloom May 11 '11 at 15:35

One could consider that what you are describing are intervals and intervals have their own mathematical notations that you can borrow from.

For example in the last century and the early part of this century intervals were typeset as:

enter image description here

In more modern books they are typeset as:

enter image description here

I think you can play around with the idea and utilize some form of the old style notation for intervals to get something like this:

enter image description here

You can use different type of brackets or annotations to distinguish between the different cases:

Some sample code:

\documentclass{article}
\usepackage{amsmath}
%%%%%%%% Special notation for intervals
\newlength{\intwidth}
\newcommand{\interval}[2]{\settowidth{\intwidth}{$#1\ #2$}\overset{|\!\rule[0.25ex]{\intwidth}{0.5pt}\!|}{#1\ #2}}
\newcommand{\linterval}[2]{\settowidth{\intwidth}{$#1\ #2$}\overset{|\!\rule[0.5ex]{\intwidth}{0.5pt}}{#1\ #2}}
\newcommand{\rinterval}[2]{\settowidth{\intwidth}{$#1\ #2$}\overset{\rule[0.5ex]{\intwidth}{0.5pt}\!|}{#1\ #2}}
%% For more modern notation 
\newcommand{\iinterval}[2]{[#1,#2]}
\newcommand{\llinterval}[2]{[#1,#2)}
\newcommand{\rrinterval}[2]{(#1,#2]}
\begin{document}


$\interval{a}{b}$

$\linterval{a}{b}$

$\rinterval{a}{b}$


$\iinterval{a}{b}$

$\llinterval{a}{b}$

$\rrinterval{a}{b}$


$\interval{\text{arbitrary}}{\text{text}}$ and some more $\interval{\text{other}}{\text{text}}$

\end{document}

I would personally find the use of different colors as an alternative very confusing.

share|improve this answer
    
This is an interesting idea. I'd like to see the OP's sentences marked up in the way you propose to compare. But be careful with the implementation: notice one of the OP's targets is more than one line long, so if you use \overset I think you're going to get many overfull hboxes. –  Matthew Leingang May 11 '11 at 14:34
    
@Matthew Leingang Would try the OP's sentence later tonight! I am not so worried about the implementation. I used maths as I had the macros available, one could use different methods to achieve the same results. –  Yiannis Lazarides May 11 '11 at 14:49
    
Some of the spans to be annotated are more than two words long, and some of them overlap (though it should help that they nest). –  Ken Bloom May 11 '11 at 15:24
up vote 0 down vote accepted

Thanks to Matthew Leingang's for introducing me to the ulem package, I was able to come up with a solution that works for me.

% Ordinarily, the \underline command doesn't wrap.
% Using ulem and the \useunder command lets the underlined text wrap the 
% way normal text does.
\usepackage[normalem]{ulem}
\useunder{\uline}{\annotationUnderlineFont}{\annotationUnderlineCommand}

% set up a length to keep track of how deep to subscript the
% annotation name. (Nested annotations need to have their names
% at different depths to keep the underline from one annotation
% from crossing out the name of another annotation.)
\newlength{\annotationdepth}       
\setlength{\annotationdepth}{-1ex} %starting depth
\newlength{\annotationdelta}       %use another length for the delta
\setlength{\annotationdelta}{2pt}  %so that it's configurable
\addtolength{\annotationdepth}{\annotationdelta}

\newcommand{\attitude}[1]{%
\addtolength{\annotationdepth}{-\annotationdelta}%
\raisebox{\annotationdepth}{\tiny attitude}%
\annotationUnderlineCommand{#1}%
\addtolength{\annotationdepth}{\annotationdelta}%
}%end of \attitude command

%other annotation commands are defined the same way as the \attitude 
%command

One of the things that was so confusing about my original solution (the one that's posted in the question) was that I hadn't made the subscripts \tiny. Changing just that helped a lot, even when I didn't replace the brackets with underlines.

After that, I changed the brackets to underlines, which also makes the sentence easier to read, and makes the exact extent of each annotation easier to see.

Lastly, moving the subscript to the beginning of the annotation makes it easier for me to control wrapping by adding hyphenation in the text being annotated.


Note that the code I've posted here is simplified to focus on the formatting, and avoid the extraneous noise caused by several things in my real code:

  1. Commands that change the formatting of the subscript names in order to emphasize certain annotations (the ones whose names are in bold) that are being introduced at different points in the document.

  2. A \newannotation command that actually defines all of the different annotation commands for me, based on the same template.

  3. A conditional that changes the text of the annotation name based on the contents of the annotation's optional parameter.

The result looks as follows (it looks less fuzzy on paper).

Example 31 Example 34 Example 42

share|improve this answer
    
What would you think about putting the annotation name below the underlined text? It would be hard to implement for texts longer than one line but would alleviate the “staircase” problem of having so many words at different heights. –  Matthew Leingang May 11 '11 at 16:21
    
@Matthew: I would love to, but I have no idea how to go about doing that (and I'd still need a good solution to the nested annotation on the word "better" in example 31). –  Ken Bloom May 11 '11 at 17:30

Your Answer

 
discard

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 or ask your own question.