Skip to Content.
Sympa Menu

texmacs-users - Re: Block of a code and long code listings

Subject: mailing-list for TeXmacs Users

List archive

Re: Block of a code and long code listings


Chronological Thread 
  • From: Giovanni Piredda <address@hidden>
  • To: address@hidden
  • Subject: Re: Block of a code and long code listings
  • Date: Sat, 4 Sep 2021 12:12:41 +0000

Hi Mėnulio,

on page-breaking in environments the most recent information I have is that it is not yet possible---please see this thread in the mailing list where Joris van der Hoeven says so:

http://forum.texmacs.cn/t/page-breaking-in-framed-or-ornamented/254

This was ten months ago, if it is still so, you will have to split the code at page ends yourself (you can use unnumbered algorithm environments for the continuations).

For the too long lines which are not broken, I have the impression that it happens because strings (like yours 'select CB41 from DUS_2014 where B21 = "F" and B25 = "%s" and B22_CLASS = "%s" and CB41<120000' are considered whole words by the line-breaking algorithm, which inside a code block is breaking lines only at the end of words (I checked that it does).

As a workaround, one could switch into text mode for the too-long string, and set its properties to match the format of a Python string in a code block; here is an example:

<with|mode|text|font-family|tt|color|dark grey|'select CB41 from DUS_2014 where B21 = "F" and B25 = "%s" and B22_CLASS = "%s" and CB41\<less\>120000'>

(in TeXmacs "dark gray" and "dark grey" are two different colors, here you want "dark grey").

Text mode also hyphenates words, and it may be not acceptable when a word is hyphenated inside a code block. I do not have a good solution for this. You can prevent hyphenation of a word by using the command "Hyphenate as" from the Format menu, and set the word to have no hyphenation points, but this would be valid for the whole document.

Sorry that the workaround I propose is so complicated, maybe someone else can simplify it or has other ideas.


Giovanni


On 03.09.21 23:36, Mėnulio Švytuoklė wrote:

Hello.
Question is very short:
How to fit code block in width of a paper, and split long listing into
a few pages?

I have attached a problematic file, in order to show a burden, because
it is very hard to understand an exact problem.

Thank anyone who would help :)



Archive powered by MHonArc 2.6.19.

Top of Page