Formatting Python code

Herbert Voss Herbert.Voss at fu-berlin.de
Mon May 30 13:41:20 UTC 2022



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



>
> 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
>
>                           data = [[f"Row {r},
> \end_layout
>
> \begin_layout Plain Layout
>
>                           Column {c}
> \backslash
> nnewline1
> \backslash
> nnewline2"
> \end_layout
>
> \begin_layout Plain Layout
>
>                           for c in range(50)]
> \end_layout
>
> \begin_layout Plain Layout
>
>                           for r in range(500)]) \end_layout
> -----
> The same code in the *.tex file is:
>         self.sheet = Sheet(self.frame,
>                           data = [[f"Row {r},
>                           Column {c}\nnewline1\nnewline2"
>                           for c in range(50)]
>                           for r in range(500)]) ------
> So why does the pdflatex *.pdf display the attached with small space 
> symbols?
>
> Rich
>



More information about the lyx-users mailing list