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 have a table with 2 columns (for vocables, but also complete sentences) and for one of these 2 columns I want to add annotations on the page border. It must however be possible to associate the annotation with a specific set of words (in case of a complete sentence on my vocable sheet where I annotate only one or several words of a sentence). I thought of something like this. However this package doesn't work when you use tables, what I'm doing ): Thank you very much for any hint!

share|improve this question
    
Out of curiosity: what package is used to produce the output in your example? =) –  Tomas Lycken Nov 23 '10 at 20:05
2  
@tomas: todonotes. –  Caramdir Nov 23 '10 at 20:09

2 Answers 2

A very rough draft:

%&pdflatex
\documentclass{article}

\usepackage{tikz}

\newcommand\remarkomark[2]{%
  \tikz[remember picture,baseline=(start-#1.base)]%
    \node[draw=orange](start-#1){#2};%
}
\newcommand\remarkotext[2]{%
  \marginpar{\tikz[remember picture]%
    \node[fill=orange!20,rectangle,text width=\marginparwidth](end-#1){#2};}%
  \tikz[remember picture,overlay]%
    \draw[overlay,<-,thick,red] %
      (end-#1.west)-- ++ (-0.5\marginparsep,0)
      |- (start-#1.south);%
}

\newcommand\remarko[3]{%
  % #1 symbolic name for node positions
  % #2 marked text
  % #3 explanation in border
  \tikz[remember picture,baseline=(start-#1.base)]%
    \node[draw=orange](start-#1){#2};%
  %
  \marginpar{\tikz[remember picture]%
    \node[fill=orange!20,rectangle,text width=\marginparwidth](end-#1){#3};}%
  \tikz[remember picture,overlay]%
    \draw[overlay,<-,thick,red] %
      (end-#1.west)-- ++ (-0.5\marginparsep,0)
      |- (start-#1.south);%
}

\begin{document}
  It's just filling anyway. It's just filling anyway. It's just filling anyway.
  Lorem ipsum dolor \remarko{test}{sit}{or stand or whatever} amet.
  Does it make a difference what I write here? It's just filling anyway.
  It's just filling anyway. It's just filling anyway. It's just filling anyway.
  Lorem ipsum dolor \remarko{test2}{sit}{or stand or whatever, hell I might
  even be yodeling?} amet.
  \begin{table}\centering
  Does it make a difference what I write here?
  Lorem ipsum dolor \remarkomark{test3}{sit} amet.
  Does it make a difference what I write here?
  Lorem ipsum dolor \remarkomark{test4}{sit}{or stand or whatever} amet.
  Does it make a difference what I write here?
  \end{table}
  \remarkotext{test3}{or stand or whatever}
  \remarkotext{test4}{or stand or whatever, I might even be yodeling?}
\end{document}

Still to do:

  • a proper double-bent path
  • twopage mode

Oh, and it'll need two pdflatex runs and of course it'll break if your explanation falls onto a different page. But there's not much you can do in that case anyway.

share|improve this answer
    
Thank you for your effort Ulrich, that looks really great! (and interesting you can do such things with such a small piece of code). It's also exactly what I am looking for - unfortunately it also doesn't work in tables, that's one not yet fulfilled requirement I have. Do you or anyone else know how one could get this working in tables? –  stefan.at.wpf Nov 24 '10 at 10:41
    
Another thing, but not that important: If the explanation falls on a different page, it breaks (like you already mentioned). Any chance to move the comment completely to the next page? There would be one comment missing on the page before the comment, so you could easily associate the comment "by hand". –  stefan.at.wpf Nov 24 '10 at 10:43
    
for the archive: 2 screenshots of ulrichs solution: imagebanana.com/view/soi6okgf/remarko1.jpg imagebanana.com/view/2ik15dti/remarko2.jpg On the later one you can see the page break problem. –  stefan.at.wpf Nov 24 '10 at 10:44
    
oh and how could one change the comment position to the left page border? Thank you very much and I hope I now don't have new ideas, it's now enough spam ;-) –  stefan.at.wpf Nov 24 '10 at 10:48
    
@stefan: I'd probably use something along the lines of KomaScript's \ifpageodd or whatsitsname and make the .west (vs. .east) conditional on that. If you want to go on the inner margin, that's the optional argument to \marginpar instead of the mandatory one, I believe. –  Ulrich Schwarz Nov 24 '10 at 13:00

I'm not exactly sure what you are looking for. I made a slap-dash example, mostly to see whether I understand what you are asking. Here's the code, and a pdf. If this is close to what you want, it would be easy to automate this with a macro.

\documentclass{article}
\usepackage{pst-all}
\begin{document}
\centerline{\bfseries My Table}\par
\begin{tabular}[t]{c|p{5cm}}
{\bfseries Vocables} & {\hfill\bfseries Explanations\hfill} \\\hline
\null\rule{0pt}{1pt} &  \\
{\red \framebox[1cm]{{\black blah}}} &
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent
tortor. Suspendisse scelerisque mi non risus. \\
{\blue \framebox[1cm]{{\black blee}}} &
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent
tortor. Suspendisse scelerisque mi non risus. \\
\end{tabular}

\marginpar{\red\framebox{%
\parbox{0.65in}{\black Lorem ipsum dolor sit amet, consectetur adipiscing elit.}}}

\marginpar{\blue\framebox{%
\parbox{0.65in}{\black Lorem ipsum dolor sit amet, consectetur adipiscing elit.}}}

\vspace{1cm}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent
tortor. Suspendisse scelerisque mi non risus. Duis vitae ligula eget
nunc fermentum malesuada. Class aptent taciti sociosqu ad litora
torquent per conubia nostra, per inceptos himenaeos. In ante ipsum,
iaculis quis, sollicitudin non, sagittis ut, tortor. Etiam rutrum.
Cras ut lectus at enim consectetur malesuada. Curabitur dui erat,
ultrices id, euismod vel, adipiscing at, mauris. Donec congue dui et
metus. Donec erat. Pellentesque cursus velit a velit. Morbi tincidunt
molestie diam. Nam molestie neque eget erat.
\end{document}

alt text

share|improve this answer
    
Hey bev, thank you very much for your effort! That's also an idea, but I don't want to think of colors each time, especially when I have several comments on one page. Lines relating comments and the words would be the prefered way, though one has to say that your solution works in tables :-) By the way, how could one change the comment position to the left page border? Thanks :-) –  stefan.at.wpf Nov 24 '10 at 10:50
    
@Stephan - still playing with this, now that I know what you want. Maybe tomorrow. –  bev Nov 28 '10 at 9:13
    
I am curious ;-) –  stefan.at.wpf Nov 29 '10 at 6:51

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.