我需要强调此数字列表中的某个条目,但我似乎无法\textbf{}
在工作区中使用或类似的东西minted
。我如何在 minted 中强调某些条目?
\documentclass[11pt,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[toc,page]{appendix}
\usepackage{listings}
\usepackage{minted}
\usepackage{fullpage}
\begin{document}
\begin{listing}[H]
\centering
\begin{minted}[autogobble,xleftmargin=0.1\textwidth,xrightmargin=0.1\textwidth,frame=single]{bash}
[[ 1.21105916e-03 9.98751879e-01 3.69788831e-05]]
[[ 9.31845248e-01 8.14934465e-05 6.80731535e-02]]
[[ 2.51991690e-08 1.38797950e-05 9.99986053e-01]]
[[ 2.20720409e-04 3.13331257e-05 9.99747932e-01]]
[[ 2.88604596e-03 9.97110307e-01 3.71164833e-06]]
[[ 9.65342045e-01 1.14912807e-04 3.45430225e-02]]
[[ 9.35987046e-05 2.29562909e-04 9.99676824e-01]]
[[ 3.64742687e-06 1.02245028e-03 9.98973966e-01]]
[[ 9.98075962e-01 1.79647308e-04 1.74431293e-03]]
[[ 7.45317191e-02 9.24890220e-01 5.78058825e-04]]
[[ 4.23816502e-01 1.95193406e-05 5.76164007e-01]]
[[ 5.45647919e-01 1.01446029e-04 \textbf{4.54250574e-01}]]
....
\end{minted}
\end{listing}
\end{document}
答案1
这有效:
\documentclass[11pt,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{bm}
\usepackage[toc,page]{appendix}
\usepackage{listings}
\usepackage{minted}
\usepackage{fullpage}
\begin{document}
\begin{minted}[escapeinside=||,autogobble,xleftmargin=0.1\textwidth,xrightmargin=0.1\textwidth,frame=single]{python}
[[ 1.21105916e-03 9.98751879e-01 3.69788831e-05]]
[[ 9.31845248e-01 8.14934465e-05 6.80731535e-02]]
[[ 2.51991690e-08 1.38797950e-05 9.99986053e-01]]
[[ 2.20720409e-04 3.13331257e-05 9.99747932e-01]]
[[ 2.88604596e-03 9.97110307e-01 3.71164833e-06]]
[[ 9.65342045e-01 1.14912807e-04 3.45430225e-02]]
[[ 9.35987046e-05 2.29562909e-04 9.99676824e-01]]
[[ 3.64742687e-06 1.02245028e-03 9.98973966e-01]]
[[ 9.98075962e-01 1.79647308e-04 1.74431293e-03]]
[[ 7.45317191e-02 9.24890220e-01 5.78058825e-04]]
[[ 4.23816502e-01 1.95193406e-05 5.76164007e-01]]
[[ 5.45647919e-01 1.01446029e-04 |$\bm{4.54250574e-01}$|]]
....
\end{minted}
\end{document}
输出:
这是使用文本:
\documentclass[11pt,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{bm}
\usepackage[toc,page]{appendix}
\usepackage{listings}
\usepackage{minted}
\usepackage{fullpage}
\begin{document}
\begin{minted}[escapeinside=||,autogobble,xleftmargin=0.1\textwidth,xrightmargin=0.1\textwidth,frame=single]{python}
[[ 1.21105916e-03 9.98751879e-01 3.69788831e-05]]
[[ 9.31845248e-01 8.14934465e-05 6.80731535e-02]]
[[ 2.51991690e-08 1.38797950e-05 9.99986053e-01]]
[[ 2.20720409e-04 3.13331257e-05 9.99747932e-01]]
[[ 2.88604596e-03 9.97110307e-01 3.71164833e-06]]
[[ 9.65342045e-01 1.14912807e-04 3.45430225e-02]]
[[ 9.35987046e-05 2.29562909e-04 9.99676824e-01]]
[[ 3.64742687e-06 1.02245028e-03 9.98973966e-01]]
[[ 9.98075962e-01 1.79647308e-04 1.74431293e-03]]
[[ 7.45317191e-02 9.24890220e-01 5.78058825e-04]]
[[ 4.23816502e-01 1.95193406e-05 5.76164007e-01]]
[[ 5.45647919e-01 1.01446029e-04 |\bfseries{4.54250574e-01}|]]
....
\end{minted}
\end{document}
输出:
但如果我更改为文本似乎不能接受 \bfseries 但可以与 bf 一起使用:
\documentclass[11pt,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{bm}
\usepackage[toc,page]{appendix}
\usepackage{listings}
\usepackage{minted}
\usepackage{fullpage}
\begin{document}
\begin{minted}[escapeinside=||,autogobble,xleftmargin=0.1\textwidth,xrightmargin=0.1\textwidth,frame=single]{text}
[[ 1.21105916e-03 9.98751879e-01 3.69788831e-05]]
[[ 9.31845248e-01 8.14934465e-05 6.80731535e-02]]
[[ 2.51991690e-08 1.38797950e-05 9.99986053e-01]]
[[ 2.20720409e-04 3.13331257e-05 9.99747932e-01]]
[[ 2.88604596e-03 9.97110307e-01 3.71164833e-06]]
[[ 9.65342045e-01 1.14912807e-04 3.45430225e-02]]
[[ 9.35987046e-05 2.29562909e-04 9.99676824e-01]]
[[ 3.64742687e-06 1.02245028e-03 9.98973966e-01]]
[[ 9.98075962e-01 1.79647308e-04 1.74431293e-03]]
[[ 7.45317191e-02 9.24890220e-01 5.78058825e-04]]
[[ 4.23816502e-01 1.95193406e-05 5.76164007e-01]]
[[ 5.45647919e-01 1.01446029e-04 |\bf{4.54250574e-01}|]]
....
\end{minted}
\end{document}
输出: