Skip to main content
All CollectionsAuthor Help
My code samples are getting line-wrapped with backslashes. What can I do?
My code samples are getting line-wrapped with backslashes. What can I do?

Keywords: line wrap, line-wrapped, backslash

Leanpub Support avatar
Written by Leanpub Support
Updated over a week ago

If a line of code is too long, Leanpub's book generators will automatically line-wrap the line of code, adding a backslash "continuation character" where the line of code is being broken.

Here's an article on this topic:

The best thing to do before manually adjusting your code lines, so you decide where the line wrapping happens, is to try changing the "global" settings on your book, to see if that fixes the problem.

First, try changing your Book Theme to the "Technical" theme, which increases the PDF page size from the default Nonfiction Book Theme that is used for new Leanpub books.

You can learn more about changing your Book Theme here:

Second, choose the "Custom" Book Theme and try making the Font size smaller:

In the Custom Theme, you can also try changing the Code Font:

OK, that's it!

Calls to Action for Authors

If you have any feedback or questions about this article, please email the Leanpub team about it at!

If you have any questions or thoughts on writing and self-publishing with Leanpub, please join our global community of authors in our Authors Forum here!

Interested in creating your first Leanpub book? Here are some quick tutorials for our most popular writing modes:

Are you looking for great deals on Leanpub ebooks, ebook bundles, and courses? Sign up for our Weekly and Monthly newsletter sales here!

Did this answer your question?