如何在乳胶中突出显示`\ cite`(保留换行符)

问题描述 投票:0回答:1

我如何像这样突出显示(设置背景颜色)\cite(保留换行符:[1]

当我在\hl包中尝试使用soul时出现编译错误:

\hl{\cite{xxx}}

[\mobx可以解决此问题,但不支持换行。

我也尝试过\colorbox\newcommand\hl{\bgroup\markoverwith {\textcolor{GhostWhite}{\rule[-.5ex]{2pt}{2.5ex}}}\ULon},但它们也不支持换行。

编译错误示例

main.tex:

\documentclass{article}
\usepackage{soul}
\begin{document}

\hl{{\cite{c1, c2, c3}}}

\bibliographystyle{plain}
\bibliography{ref} 
\end{document}

ref.bib:

@book{c1,
...
}
@book{c2,
...
}
@book{c3,
...
}

我的问题

  • 突出显示\cite的正确方法是什么>

我如何像这样突出显示(设置背景颜色)\ cite(保留换行符):[1]在软件包灵魂中尝试\ hl时出现编译错误,例如:\ hl {\ cite {xxx}} \ mobx可以解决此问题,但不能解决......>

latex
1个回答
1
投票

\cite宏包装到另一组大括号中:

\documentclass{article}

\begin{filecontents*}[overwrite]{\jobname.bib}
@book{knuth,
  author       = {Knuth, Donald E.},
  title        = {The {\TeX} book},
  date         = 1984,
  maintitle    = {Computers \& Typesetting},
  volume       = {A},
  publisher    = {Addison-Wesley},
  location     = {Reading, Mass.},
  langid       = {english},
  langidopts   = {variant=american},
  sortyear     = {1984-1},
  sorttitle    = {Computers & Typesetting A},
  indexsorttitle= {The TeXbook},
  indextitle   = {\protect\TeX book, The},
  shorttitle   = {\TeX book}
}
\end{filecontents*}

\usepackage{soul}

\begin{document}

\hl{{\cite{knuth}}}

\bibliographystyle{plain}
\bibliography{\jobname} 

\end{document}
© www.soinside.com 2019 - 2024. All rights reserved.