How do I export to Latex without it inserting newlines into the paragraphs?

Hi TexMacs users,

Almost every Latex editor wants paragraphs to not contain any newlines, as they wrap long lines automatically. TexMacs’ export feature unfortunately inserts such newlines in order to maintain a seemingly arbitrary maximum window width.

How do I turn this off? I didn’t see any options for this in the preference menu. I can manually go through the whole document and delete all these newlines, but it’s very tedious.

Thanks,
James

Hi and welcome to the forum.
As far as I understand, what you wish is not included in the options. I checked the file init-latex.scm in the progs/convert directory, where I assume possible options are set, and I did not see it (I looked at the function application (converter texmacs-stree latex-stree ... ).

I think this would be a good feature request (https://savannah.gnu.org/bugs/?group=texmacs, submit “bug” under Item Group->Wishlist). I haven’t been able to find the piece of code which inserts the newlines, but perhaps someone else will manage to find it.

Hi James, welcome to the forum!

As a workaround you can increase the line length using the output-set-line-length scheme command. You can press Meta+X and run (output-set-line-length 1000000000).

EDIT: for some reason this command doesn’t work from my-init-texmacs.scm file.

1 Like

It may be because TeXmacs (b/c of lazy loading) runs the functions in output.scm after my-init-texmacs.scm (and also after my-init-buffer.scm)

Setting in my-init-texmacs.scm

(import-from (convert tools output))

before

(output-set-line-length 1000000000)

seems to work.

1 Like

So I tried making a my-init-texmacs.scm file in the “progs” directory with the contents:
(import-from (convert tools output))
(output-set-line-length 1000000000)

Unfortunately, it didn’t seem to affect the Latex export. I’m using TeXmacs version 1.99.8 if that matters.

The suggestion from @pireddag also works for me. What also works for me is

(delayed (:idle 1000) (output-set-line-length 1000000000))

Which directory did you put my-init-texmacs.scm in? It needs to be in the progs folder of you TEXMACS_HOME_PATH. The easiest way to make sure you have the right file is to enable Tools -> Developer tool and the go to Developer->Open my-init-texmacs.scm.

Okay so actually the solution did work for me after all. I hadn’t made the file correctly the first time. MacOS was hiding the true extension (.txt). Thanks everyone for your help!

2 Likes

Happy that it did.
I saw that the parameter does not affect the export to some other formats (I tested TeXmacs Scheme, Python, C++ and Xml), of course it is good that it is working for LaTeX export!