如何获取含有关键词的列?

如何获取含有关键词的列?

如何在 latex 中获取并使用带有关键字的列?或者此列还有其他术语吗?

示例(截图自todonotes 文档):

答案1

\marginpar这和使用在边距中写入内容一样简单。以下是其中一个选项:

在此处输入图片描述

\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}

答案2

我找到了一种适合我的方法:

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

使用示例: 在此处输入图片描述

\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

相关内容