While using org-mode to export source code to PDF files, the source code is not aligned with the indentation of the text.

The .org file are as follow:

enter image description here

And the output result looks like this:

enter image description here

Would there be a way to align the indentation of the code block, or to center it?

1 Answer 1


The line "The following pre" is the first line of its paragraph (it's the only line of its paragraph), and is thus indented. Try a longer paragraph before the source block to see that it does match the indentation of the subsequent lines of the paragraph, just not the first one.

If you don't want the first line of the paragraph indented change it to:

\noindent The following pre

If you don't want any first line of any paragraph to be indented, add this to the top of your Org mode document:

#+LATEX_HEADER: \setlength{\parindent}{0pt}

If you want the source block horizontally centered, put it inside a center block:

#+begin_src sql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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