![如何强制使 \texttt 中的括号 [][] 彼此靠近?](https://linux22.com/image/249976/%E5%A6%82%E4%BD%95%E5%BC%BA%E5%88%B6%E4%BD%BF%20%5Ctexttt%20%E4%B8%AD%E7%9A%84%E6%8B%AC%E5%8F%B7%20%5B%5D%5B%5D%20%E5%BD%BC%E6%AD%A4%E9%9D%A0%E8%BF%91%EF%BC%9F.png)
\documentclass{article}
\begin{document}
Normal margin here. Normal margin here. Normal margin here.
Normal margin here. Normal margin here. Normal margin here. Normal margin here.
Abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcd: \texttt{float[][]} and
\texttt{double[][]}.
\end{document}
如您所见,[]
与其他相距甚远[]
。我怎样才能使它们彼此更接近?更重要的是,double[][]
超出了边缘线。如何写得更好?
我正在使用 minted 包。是否可以使用它来内联编写小代码示例?
答案1
如果它不经常出现或者您可以使用搜索和替换,您可以自己添加负空间来弥补它:
\documentclass{article}
\begin{document}
Normal margin here. Normal margin here. Normal margin here.
Normal margin here. Normal margin here. Normal margin here. Normal margin here.
Abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcd: \texttt{float[]$\!$[]} and
\texttt{double[]\kern-.2em[]}.
\end{document}
理论上,也应该可以更改]
和的字距[
,但我不能告诉你这是否可以通过一些合理的工作来实现。也许这个microtype
包可以帮到你?