我正在撰写一份报告,该报告将以一种方式构建(即各个章节已经规定),但我需要明确说明整个报告中如何满足各种评估标准 - 这些标准可以在报告的许多不同地方得到解决。
是否有任何软件包或配方可以让我用清晰且丰富多彩的内容注释我的报告,以便我一目了然地了解我针对不同标准的位置。这可以是每个小节或每个段落。
我知道这\marginpar{Citerion 2, Criterion 6}
可能是一种非常基本的方法,但我希望得到更漂亮的效果(例如类似于博客文章上的“标签”)。如果能写出类似这样的内容就好了:
\subsection{Seminars and Symposia}
\tag{Collaboration}
\tag{Communication}
Interesting things in this section...
\subsection{Training}
在此先感谢您的任何建议。
答案1
可以通过 轻松实现colorbox
。
作为参考,请查看同时突出显示、文本颜色和粗体
如果您总是使用相同的颜色并且想要保存一些击键,我还定义了一个\tag
命令,如您在示例中发布的:
\newcommand{\tag}[1]{\colorbox{green}{#1}}
当然使用您喜欢的颜色!
使用tcolorbox
您可以实现更多奇特的结果(第 0.3 小节)。另请参阅此处:如何在行内单词周围添加一个小圆角矩形
\documentclass{article}
\usepackage{xcolor}
\usepackage{tcolorbox}
\usepackage{lipsum}
\newcommand{\tag}[1]{\colorbox{green}{#1}}
\newtcbox{\fancytag}[1][red]{% see tcolorbox manual at page 16
on line,
arc = 7pt,
colback = #1!10!white,
colframe = #1!50!black,
before upper = {\rule[-3pt]{0pt}{10pt}},
boxrule = 1pt,
boxsep = 0pt,
left = 6pt,
right = 6pt,
top = 2pt,
bottom = 2pt
}
\begin{document}
\subsection{Seminars and Symposia}
\colorbox{green}{Collaboration}
\colorbox{green}{Communication}
\subsection{Training}
\tag{Collaboration}
\tag{Communication}
\subsection{More fancy solution}
\fancytag{Collaboration}
\fancytag{Communication}\\[\baselineskip]
Using \texttt{tcolorbox}.
\subsection{In the margins}
\marginpar{
\fancytag{Collaboration}
\fancytag{Communication}
}
\lipsum[1]
\end{document}
答案2
单程是\usepackage{soul}
\documentclass{article}
\usepackage[width=5.05cm]{geometry}
\usepackage{color,soul}
\begin{document}
\noindent\hl{Highlighting} text feels good.
You can draw attention of people to a \hl{word} or perhaps
\hl{even a whole sentence that spans across multiple lines
in such a way that hyphenation etc. are not affected.}
\end{document}
或者使用 soul 和 tikz 结合起来
\documentclass{minimal}
\usepackage{soul}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathmorphing}
\makeatletter
\newcommand{\defhighlighter}[3][]{%
\tikzset{every highlighter/.style={color=#2, fill opacity=#3, #1}}%
}
\defhighlighter{yellow}{.5}
\newcommand{\highlight@DoHighlight}{
\fill [ decoration = {random steps, amplitude=1pt, segment length=15pt}
, outer sep = -15pt, inner sep = 0pt, decorate
, every highlighter, this highlighter ]
($(begin highlight)+(0,8pt)$) rectangle ($(end highlight)+(0,-3pt)$) ;
}
\newcommand{\highlight@BeginHighlight}{
\coordinate (begin highlight) at (0,0) ;
}
\newcommand{\highlight@EndHighlight}{
\coordinate (end highlight) at (0,0) ;
}
\newdimen\highlight@previous
\newdimen\highlight@current
\DeclareRobustCommand*\highlight[1][]{%
\tikzset{this highlighter/.style={#1}}%
\SOUL@setup
%
\def\SOUL@preamble{%
\begin{tikzpicture}[overlay, remember picture]
\highlight@BeginHighlight
\highlight@EndHighlight
\end{tikzpicture}%
}%
%
\def\SOUL@postamble{%
\begin{tikzpicture}[overlay, remember picture]
\highlight@EndHighlight
\highlight@DoHighlight
\end{tikzpicture}%
}%
%
\def\SOUL@everyhyphen{%
\discretionary{%
\SOUL@setkern\SOUL@hyphkern
\SOUL@sethyphenchar
\tikz[overlay, remember picture] \highlight@EndHighlight ;%
}{%
}{%
\SOUL@setkern\SOUL@charkern
}%
}%
%
\def\SOUL@everyexhyphen##1{%
\SOUL@setkern\SOUL@hyphkern
\hbox{##1}%
\discretionary{%
\tikz[overlay, remember picture] \highlight@EndHighlight ;%
}{%
}{%
\SOUL@setkern\SOUL@charkern
}%
}%
%
\def\SOUL@everysyllable{%
\begin{tikzpicture}[overlay, remember picture]
\path let \p0 = (begin highlight), \p1 = (0,0) in \pgfextra
\global\highlight@previous=\y0
\global\highlight@current =\y1
\endpgfextra (0,0) ;
\ifdim\highlight@current < \highlight@previous
\highlight@DoHighlight
\highlight@BeginHighlight
\fi
\end{tikzpicture}%
\the\SOUL@syllable
\tikz[overlay, remember picture] \highlight@EndHighlight ;%
}%
\SOUL@
}
\makeatother
\begin{document}
Lorem ipsum \highlight{dolor sit amet, consectetur adipis-icing elit, sed do
eiusmod tempor} incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation \highlight[red]{ullamco $laboris$ nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit} in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat \highlight[green, draw=blue]{cupidatat non proident,
suntinculpaquiofficiadeseruntmollitanimidestlaborum.
Loremipsumdolorsitametconsecteturadipisicingelitseddoeiusmodtemporincididuntutlabore-etdoloremagnaaliqua.}
I suppose I could write some more text here.
\end{document}
礼貌 - LaTeX 中的酷炫文本突出显示