0

When converting from Org-mode to PDF, the first line of a paragraph is automatically indented:

   aaaaaa bbbbb
ccccc ddddd eee
ee fffff ggggg

This is fine. However, I would like to disable it when I have a single line paragraph, e.g. (Org-mode file):

A linear function:

$y = 2x$

A non-linear function:

$y = sin(x)$

The output I get now, through Emacs, is (e.g. PDF):

    A linear function:

    y = 2x

    A non-linear function:

    y = sin(x)

This is how I would like it:

A linear function:

y = 2x

A non-linear function:

y = sin(x)

Is there an #+OPTIONS: in Org-mode that allows to set this?

How can I configure Org-mode/Emacs so that the generated LaTeX file does not indent the first line of a paragraph?

3
  • 2
    The first line of a paragraph is automatically indented - no, it is not. Whether something is indented depends on many things, e.g. the major mode of the file, any enabled minor modes and a host of other options, none of which you specify above. If you are talking about Org mode files, exported to PDF, please say so. In particular, the indentation of the first line of a paragraph in that case is because LaTeX does it this way by default. So you need to figure out how to turn it off in LaTeX and then figure out how to get Org mode to tell LaTeX to do that. Please clarify the question.
    – NickD
    Commented Dec 16, 2023 at 15:59
  • @NickD - Thank you for your suggestion. I hope my question is clearer now.
    – Pietro
    Commented Dec 18, 2023 at 0:30
  • Much better, thanks!
    – NickD
    Commented Dec 18, 2023 at 0:54

1 Answer 1

1

You can easily check that it's LaTeX that indents the first line of a paragraph (actually, it does not indent the first line of the first paragraph when you use the standard document classes - e.g. article).

The next step is to find out how to make LaTeX to not do that. You can post a question on TeX SE for that, or you can read some LaTeX documentation. E.g. in section C.3.2, p.172 of Lamport's "LaTeX User Guide and Reference manual, you find out that the relevant length is called \parindent. Or see section 6.3.2, p. 112 of Tobias Oetiker's Not So Short Introduction to LaTeX for similar information. You can set it to 0 by adding

\setlength{\parindent}{0pt}

in the preamble of the LaTeX document. The second document shows exactly this command.

That's the hard part. To produce a LaTeX document that includes this command from your Org mode document, add the following line to your file:

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

and you are done.

Most questions about how to change the appearance of a PDF produced from a LaTeX document exported from an Org mode file, are resolved in exactly the same way: first, you have to learn enough LaTeX to at least know where to get some documentation, then you have to figure out what exactly you have to change, then try it out in a LaTeX document (I often modify the LaTeX document that Org mode exports by hand, adding/deleting/changing things while I compile it by hand on the command line), then (the easy part) figure out how to include those changes into an Org mode file so that they end up in the LaTeX file. It's not always as simple as the case you asked about BTW: you might have to learn more LaTeX in order to implement a solution.

IOW, it is not enough to treat LaTeX as a black box, except for the simplest exports, the ones where what Org mode produces is good enough. For anything more complicated, you'll have to learn some LaTeX. The "Not So Short Introduction" linked above is a good beginner tutorial (and it's available in many translations as well - see https://ctan.org/tex-archive/info/lshort).

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.