jlcode icon indicating copy to clipboard operation
jlcode copied to clipboard

Does not respect linewidth

Open KronosTheLate opened this issue 3 years ago • 9 comments
trafficstars

I frequently have the problem that jlinl text at the end of lines does not break or move, but completely ignores the linewidth: image

That does not look great, and requires manual fiddling to make right. Would it be possible to fix?

KronosTheLate avatar May 17 '22 09:05 KronosTheLate

Unfortunately I don't think that this can be fixed easyily because jinln is mainly just the command \lstinline from the listings pakcage itself. So what you experience here is what being prodced due to the nature of the listings package and it implementation and not due to the implementation of this package.

"Manual fiddling" is likely the best we can do here as far as I can see right now.

wg030 avatar May 17 '22 14:05 wg030

Is this a know issue within listings? Or should this issue be raised over there?

KronosTheLate avatar May 23 '22 12:05 KronosTheLate

Is this a know issue within listings? Or should this issue be raised over there?

Well, I don't really know. But honestly, I would assume that the do not really consider this to be an issue at all.

I mean the problem here is that your expression n_inital and especially sample_n_ANNS are coherent, long expressions that you would normally not want to be split. So latex tries it's best under the assumption that this expression needs to be coherent, which means you will either create an overfull box and have a line longer than the textwidth or an underfull box and have a line with a lot of whitespace and your expressions starting at the next line. There is no way of having a coherent expression, no underfull box and no overfull box at the same time. See what I mean?

wg030 avatar May 30 '22 10:05 wg030

Absolutely. The way I would fix this for text is to put it inside a \hbox{}, which ends up filling all lines from left to right, without going into the page margin. This would be the preferred behaviour IMO.

KronosTheLate avatar Jun 27 '22 15:06 KronosTheLate

This would be the preferred behaviour IMO.

Could you show me a picture of how your example looks when you do it like that? I am not so sure if I could agree here on that being the preferred behaviour because I would expect to have a lot of white space in the text. But then again, if one does or cannot change the forumlation of the text, this might be the best solution indeed.

wg030 avatar Jun 27 '22 18:06 wg030

I don't have time right now, but I commonly use it to keep e.g. an inline equation on the same line. Yes, there is extra whitespace, but it looks way better than breaking into the margin. Feel free to try including more and more of a text in the \hbox{}, to get a feel for the behaviour. I have always liked the output from it "in the wild", e.g. in real use.

KronosTheLate avatar Jun 27 '22 18:06 KronosTheLate

Ah, I see. I never really work with \hbox{} because I personally prefer changing some words or the order of words in a setence in theses cases. When I have some more time I might go for some testing here, but right now I am busy, too.

wg030 avatar Jun 28 '22 12:06 wg030

Conributing to open source stuff is always a guilty pleasure to me - there is never time, and never anything forcing it to get done.

Thanks for being so responsive, and thanks for the amazing package. I have now used it A LOT for several important reports, including my bachelor thesis ^_^

KronosTheLate avatar Jun 29 '22 09:06 KronosTheLate

Conributing to open source stuff is always a guilty pleasure to me - there is never time, and never anything forcing it to get done.

That's a great attitude, which I do share. If one profits from a project and can somehow contribute to it one should feel obligated to do so imho.

Thanks for being so responsive, and thanks for the amazing package. I have now used it A LOT for several important reports, including my bachelor thesis ^_^

You are very welcome and it makes me happy to hear that this package is so useful for you!

wg030 avatar Jun 29 '22 11:06 wg030