Question

The listings package supports line breaks inside lstlisting environment. But it doesn't produce automatic line breaks for lstinline environment. For example, in the following paragraph the first line flows out of the margins:

The parameters \lstinline|base_rmr_brain|, \lstinline|base_rmr_fat|, and \lstinline|baseline_basal_rmr_of_lean_tissues| are metabolic rates of brain, fat, and lean tissues in kcal/(kg*day). The parameter \lstinline|mass_brain| denotes the mass of the brain in gram.

Is there any solution for this problem?

Was it helpful?

Solution

The literate feature of listings could be helpful, e.g. to introduce linebreaks at underscores:

\lstset{
  literate={\_}{}{0\discretionary{\_}{}{\_}}%
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top