换行符未出现在最佳位置

换行符未出现在最佳位置

由于某种原因,尽管使用了该microtype包,我还是无法修复段落中的一些过度填充,如下图所示。

我希望每个函数调用的左括号后立即换行。我尝试通过在每个函数的第一个参数和每个函数的左括号之间放置零宽度空格来解决这个问题。

理想情况下,我希望解决方案也能与该\lstinline命令兼容。

示例段落

\subsubsection{Map Scanning and Information Analysis}
Before any route-finding can occur, the map on which the robot finds itself must be internalised. There are three functions which are used for this purpose: getChosenArea(\hspace{0pt}gameEnvironment, topLeft, bottomRight), getMapMax(\hspace{0pt}gameEnvironment, gameType=1) and getMapRadius(\hspace{0pt}gameEnvironment, radius). All each of these do is scan the area specified in the parameters, and return a \Map{} object.

答案1

由于涉及这么多非语法词,最简单的方法是使用sloppypar,如小节中的第 2 个实例所示。

在 MWE 中,\leftskip只是为了匹配 OP 的未指定边距。

\documentclass{article}
\newcommand\Map{\texttt{Map}}
\begin{document}
\leftskip1.5in\relax
\subsubsection{Map Scanning and Information Analysis}
Before any route-finding can occur, the map on which the robot finds itself must be internalised. There are three functions which are used for this purpose: getChosenArea(\hspace{0pt}gameEnvironment, topLeft, bottomRight), getMapMax(\hspace{0pt}gameEnvironment, gameType=1) and getMapRadius(\hspace{0pt}gameEnvironment, radius). All each of these do is scan the area specified in the parameters, and return a \Map{} object.

\subsubsection{Map Scanning and Information Analysis}
\begin{sloppypar}
Before any route-finding can occur, the map on which the robot finds itself must be internalised. There are three functions which are used for this purpose: getChosenArea(\hspace{0pt}gameEnvironment, topLeft, bottomRight), getMapMax(\hspace{0pt}gameEnvironment, gameType=1) and getMapRadius(\hspace{0pt}gameEnvironment, radius). All each of these do is scan the area specified in the parameters, and return a \Map{} object.
\end{sloppypar}
\end{document}

在此处输入图片描述

相关内容