2

How do I get and use a column with keywords in latex? Or is there another term for this column?

Example (screenshot from todonotes doc):

  • You should look at the source code... it includes the documentation. – Werner Oct 3 '18 at 16:35
  • I was hoping not to dive into dtx-file structure since I have never used it before. ;) – Thomas Zuberbühler Oct 3 '18 at 19:23
3

This is as straight forward as using a \marginpar to write content in the margin. Here is one option:

enter image description here

\documentclass{article}

\newcommand{\keyword}[1]{%
  \marginpar{\raggedleft\small\keywordfont #1}%
  {\keywordfont #1}%
}

\newcommand{\keywordfont}{\ttfamily}

\begin{document}

\reversemarginpar % For \marginpar on the left

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras pretium 
condimentum dignissim. Proin eu ullamcorper lacus, id \keyword{vehicula} eros. Cras 
convallis dolor quam, laoreet pellentesque neque aliquam eu. Donec odio magna, 
laoreet at fringilla et, varius vitae ipsum. Nulla facilisi. Mauris ut \keyword{finibus} 
mi, sed bibendum quam. Mauris ut blandit quam.

Aenean consequat hendrerit lacus, id hendrerit tellus sodales quis. Etiam dapibus 
tellus sit amet nisl molestie, at euismod sapien commodo. \keyword{integer} \keyword{tristique} 
dui quis nibh malesuada tincidunt. Nulla facilisi. Pellentesque habitant morbi tristique 
senectus et netus et \keyword{malesuada} fames ac turpis egestas. Morbi mi neque, sollicitudin 
bibendum fringilla vitae, tincidunt nec mi. Donec placerat sapien eu turpis aliquet, 
in tempor lorem molestie. Curabitur faucibus turpis non tortor auctor mattis. Duis 
tempor congue eros vitae \keyword{condimentum}.

\end{document}
| improve this answer | |
  • Thank you. I came up with a slightly different solution just a few minutes as well. However, I am going to accept your answer. :) Thank you for your example! – Thomas Zuberbühler Oct 3 '18 at 19:45
1

I have found an approach which works for me:

\usepackage{marginnote}
\newcommand{\keyword}[1]{\reversemarginpar \marginnote{\textbf{#1}}}
\newcommand{\dict}[2]{#1\normalmarginpar \marginnote{{\small #1: #2}}}

Example usage: enter image description here

\paragraph{}
\keyword{Swiss German} "Swiss German (Standard German: Schweizerdeutsch, Alemannic 
German: Schwyzerdütsch, Schwiizertüütsch, Schwizertitsch Mundart and others) is any
of the Alemannic dialects spoken in the German-speaking part of Switzerland and in 
some Alpine communities in Northern Italy bordering Switzerland. Occasionally, the 
Alemannic dialects spoken in other countries are grouped together with Swiss 
German, as well, especially the dialects of Liechtenstein and Austrian Vorarlberg, 
which are closely \dict{associated}{verbunden, assoziiert, angeschlossen} to 
Switzerland's." (Source: Wikipedia)

\paragraph{}
\keyword{Lorem ipsum} \lipsum[1]  % \usepackage{lipsum} required
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.