Re: Formatting Python code

2022-05-30 Thread Dr Eberhard Lisse
STOP. USING. ERT! :-)-O In Settings -> Document -> Listings you can set things into the window which wind up in the generated tex file as \lstset{} greetings, el On 2022-05-27 23:20 , Rich Shepard wrote: On Fri, 27 May 2022, Rich Shepard wrote: Thanks for the pointer. Paul, Since all

Re: Formatting Python code

2022-05-30 Thread Rich Shepard
On Mon, 30 May 2022, Rich Shepard wrote: That's interesting. I don't find "showspaces" anywhere in the document settings. Where do I turn it off? Herbert, Found it: Edit -> Listing settings -> Style -> Space in string as symbols. Thanks again, Rich -- lyx-users mailing list

Re: Formatting Python code

2022-05-30 Thread Rich Shepard
On Mon, 30 May 2022, Herbert Voss wrote: you have set the listings option "showspaces" and also one indention with spaces instead of tabs. "showspaces" makes no sense with python code. Herbert, That's interesting. I don't find "showspaces" anywhere in the document settings. Where do I turn

Re: Formatting Python code

2022-05-30 Thread Rich Shepard
On Mon, 30 May 2022, Herbert Voss wrote: It _does_ support tab characters, e.g. Herbert, But not in the Tkinter widget code documentation I'm making into a readable format using LyX. The small space character issue in the pdflatex output is associated with the Python-3.6+ formatted strings;

Re: Formatting Python code

2022-05-30 Thread Herbert Voss
Am 30.05.22 um 15:38 schrieb Rich Shepard: Here's an issue that's appeared twice (so far) in the document and I cannot find the reason. you have set the listings option "showspaces" and also one indention with spaces instead of tabs. "showspaces" makes no sense with python code. Herbert

Re: Formatting Python code

2022-05-30 Thread Rich Shepard
Here's an issue that's appeared twice (so far) in the document and I cannot find the reason. The *.lyx code in a Program Listing environment looks like this: - \begin_layout Plain Layout self.sheet = Sheet(self.frame, \end_layout \begin_layout Plain Layout

Re: Formatting Python code

2022-05-30 Thread Herbert Voss
Am 30.05.22 um 14:48 schrieb Rich Shepard: I learned the reason for the spacing issues is that the program listing environment does not support tabs for white space, only spaces. Kinda' hard on the keyboard's space bar. :-) It _does_ support tab characters, e.g. \documentclass{article}

Re: Formatting Python code

2022-05-30 Thread Rich Shepard
On Fri, 27 May 2022, Paul A. Rubin wrote: If the code was copied from outside LyX and pasted in, maybe there are some stray nonprinting characters and/or one of the supposed end-of-line characters is borked. The simplest way to test this would be to backspace over the offending commas and

Re: Formatting Python code

2022-05-27 Thread Paul A. Rubin
On 5/27/22 18:44, Rich Shepard wrote: 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

Re: Formatting Python code

2022-05-27 Thread Rich Shepard
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

Re: Formatting Python code

2022-05-27 Thread Paul A. Rubin
On 5/27/22 17:39, Rich Shepard wrote: On Fri, 27 May 2022, Rich Shepard wrote: \lset{language=Python, Tabulator size=4} Paul, A more recent thread on program listings shows the command as \lstset{} but this also fails to set the default and throws an error when I try to compile the

Re: Formatting Python code

2022-05-27 Thread Rich Shepard
On Fri, 27 May 2022, Rich Shepard wrote: \lset{language=Python, Tabulator size=4} Paul, A more recent thread on program listings shows the command as \lstset{} but this also fails to set the default and throws an error when I try to compile the document. Puzzled, Rich -- lyx-users mailing

Re: Formatting Python code

2022-05-27 Thread Rich Shepard
On Fri, 27 May 2022, Rich Shepard wrote: Thanks for the pointer. Paul, Since all the code in the document is the same language I searched the web for setting defaults. Found a list archive thread from 10 years ago and your response was to add the language and other attributes to the

Re: Formatting Python code

2022-05-27 Thread Rich Shepard
On Fri, 27 May 2022, Paul A. Rubin wrote: Rather than LyX-Code, start with Insert > Program Listing to insert a listings widget. Right click the widget, click Settings ..., and on the main settings tab use the Language drop-down to select Python. Tweak other settings at will. Paul, Ah ha!

Re: Formatting Python code

2022-05-27 Thread Paul A. Rubin
On 5/27/22 15:01, Rich Shepard wrote: I'm trying to format Python code in a document, but cannot properly set indentation and long lines without them breaking. The document class is KOMA Article. I've set the code environment to LyX-Code. Reading the User Guide, I don't find a section on

Formatting Python code

2022-05-27 Thread Rich Shepard
I'm trying to format Python code in a document, but cannot properly set indentation and long lines without them breaking. The document class is KOMA Article. I've set the code environment to LyX-Code. Reading the User Guide, I don't find a section on LyX-Code; Section 6.10 is TeX Code and the