[Tex/LaTex] CSS border-top, border-bottom, border-right LaTeX equivalent


Is there an equivalent in LaTeX to the CSS border-top, border-bottom, border-right properties?

I would like to underline and overline text with with a border on the right, not simply underline or overline it. So instead of a simple underline the text would get underlined/overlined with a border on the right.

Here's an example of what I would like to do (in CSS): http://accent.u-biq.org/english.html

I saw PDFs with such annotation before, so I'm pretty sure it can be done.

(Four tags for Google search: Japanese pitch accent annotation)

Best Answer

As I already answered to the cross-post on LaTeX-Community.org: a quick and easy way would be to define a TikZ matrix for the characters, where each character is a node which can be referred to, for drawing such a path.

For example:

  \matrix (m) [matrix of nodes]{
    A & B & C & D & E\\};
  \draw (m-1-1.north west) -- (m-1-1.north east) -- (m-1-1.south east)
    -- (m-1-2.south west) -- (m-1-2.south east) -- (m-1-2.north east)
    -- (m-1-5.north east);

path around symbols