0

I'm writing a document with some long strings on it, then I export the org file to pdf with the classic C-c C-e l p . Then when I check the document, the long string are out of the page. How can I fix this?

My code is:

*** Setting up the environment setup to build
The code must be compiled in a docker container, this docker container can be generated from the image described in the file _Dockerfile_ which can be found in the repository thisis@a-very-long-line-which-will-be.at.doc/with/a/commit/that/will/not/gonna/appear/where/is/supposed at commit a59590ee2c2bc02d5e71b0a944d927e181d93aeb

Output of exported file

As you can see the document run off of document. This happens in several places with large words, what must I do to prevent this?

1

This is a LaTeX problem and has to be solved at that level. Org mode delegates all the formatting to it for PDF output. There are many tips and tricks that can be used to get LaTeX to do a better job of line breaking, but the most important rule is to not give it long things that it cannot break - and if you have to, you have to help it to decide where to break the line.

For this particular case, the culprit is the long URL of the repo: you can deal with that problem by using the \url macro, like this:

*** Setting up the environment setup to build
The code must be compiled in a docker container, this docker container can be generated from the image described in the file _Dockerfile_ which can be found in the repository \url{thisis@a-very-long-line-which-will-be.at.doc/with/a/commit/that/will/not/gonna/appear/where/is/supposed} at commit a59590ee2c2bc02d5e71b0a944d927e181d93aeb.

which will produce modified PDF image

In general, these problems are usually resolved by small tweaks in the input (adding hyphenation points to long words, changing the text slightly by choosing different words or changing the word order), by small modifications to allow LaTeX to find better breaking points (e.g. by changing the \tolerance value), by using the appropriate construct (e.g. the above use of \url) or by other ad-hoc methods (of which there are many). Search for overfull box in the TeX SE site for many examples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.