Formatting Python code

Rich Shepard rshepard at appl-ecosys.com
Fri May 27 22:44:37 UTC 2022


On Fri, 27 May 2022, Paul A. Rubin wrote:

> AFAIK, \lstset{} is the correct command. In order to use it in the
> preamble, you have to precede it with \usepackage{listings}.

Paul,

I overlooked that.

> The correct syntax for setting the tabulator size is tabsize=4. "Tabulator
> size=4" will cause an error.

Okay. I wondered about that string.

> Setting package defaults in the preamble will not register in the LyX
> settings dialog, but they will work. So the dialog will continue to say
> "no language" and tab size 4 (or whatever the dialog defaults are), but
> your preamble settings will work in the compiled document.

Good.

Now I find an error in the complied document that makes no sense.

In one code block are these lines:
row_index_width = 100,
auto_resize_default_row_index = True,
set_all_heights_and_widths = False,
row_height = "1",

but in the PDF the middle two lines are combined and there are spaces before
the terminating commas:
row_index_width = 100,
auto_resize_default_row_index = True , set_all_heights_and_widths = False ,
row_height = "1",

So far I've not been able to figure out why so I'll worry about this tomorrow.

Thanks,

Rich


More information about the lyx-users mailing list