Text FormattingSupertext issue

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
cvilhelm
Posts: 4
Joined: Mon Mar 16, 2009 8:44 pm

Supertext issue

Post by cvilhelm »

I'm looking to label different words in a sentence (well, it'll be a lot of sentences if I get this to work) with their function in the sentence. Take a look at the attached image to see what I mean.

... is there a package or something in LaTeX that can do that?

Thanks,
-Wm
Attachments
text_problem.png
text_problem.png (2.48 KiB) Viewed 2240 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Supertext issue

Post by nlct »

I don't know of any package that suits your purpose, but you could do something like:

Code: Select all

\documentclass{article}

\usepackage{amsmath}

\newcommand*{\word}[2]{\shortstack{\tiny\smash[b]{#1}\\\rule{0pt}{2ex}#2}}

\begin{document}
\word{article}{The} \word{noun/subject}{fence} \word{LV}{is}
\word{predicate adj.}{white.}

\end{document}
or to make typing simpler:

Code: Select all

\documentclass{article}

\usepackage{amsmath}

\newcommand*{\word}[2]{\shortstack{\tiny\smash[b]{#1}\\\rule{0pt}{2ex}#2}}

\newcommand*{\art}[1]{\word{article}{#1}}
\newcommand*{\nounsub}[1]{\word{noun/subject}{#1}}
\newcommand*{\LV}[1]{\word{LV}{is}}
\newcommand*{\predadj}[1]{\word{predicate adj.}{#1}}

\begin{document}
\art{The} \nounsub{fence} \LV{is} \predadj{white.}

\end{document}
Note that if you do this, you won't have any hyphenation, so it might be better to use \raggedright.

Regards
Nicola Talbot
cvilhelm
Posts: 4
Joined: Mon Mar 16, 2009 8:44 pm

Re: Supertext issue

Post by cvilhelm »

Hmmm, that should work nicely.

Thank you so much. :D
-Wm
Post Reply