2

How can I export so that both subscripts and indentation are respected? For example, using QUOTE will respect special characters like subscripts, but will ignore spacing. The opposite is true of EXAMPLE or SRC blocks.

#+BEGIN_QUOTE
let x_m be the constraints over x_n variables

set all x_n = false

for x_i \in right-hand sides of x_m while equation X is FALSE:\\
   x_i = true\\
   if X is true, return TRUE\\
return FALSE
#+END_QUOTE

1 Answer 1

1

Export to pdf is handled by LaTeX, and org-mode only manages a small subset of the possible options. EXAMPLE blocks are exported as verbatim environments, which will change none of your text - it respects all your whitespace, but will not process any macros (such as your subscripts).

On the other hand, quote blocks are exported as quote environments. These do process macros, but impose LaTeX spacing algorithms.

There is no halfway. If you were writing in pure LaTeX, you would have all kinds of options. org-mode doesn't support them, but you can include raw LaTeX in your org-mode file, and it will be respected during export (as long as it's not in an example block). This being the case, you can insert a bit of LaTeX to get what you want. A relatively simple approach would be:

#+BEGIN_QUOTE
let x_m be the constraints over x_n variables

set all x_n = false

for x_i \in right-hand sides of x_m while equation X is FALSE:\\
\hspace*{2em}  x_i = true\\
\hspace*{2em}  if X is true, return TRUE\\
return FALSE
#+END_QUOTE

The output looks fine, but it's a bit ugly in your org mode file.

2
  • I can readily include an #+BEGIN_EXPORT latex. Even in Latex, though, I was hoping there was something better than individual hspace commands and line breaks... Oct 22, 2019 at 23:47
  • This is how I'd do it in LaTeX as well. By design, LaTeX doesn't make it easy to manage white space manually. Another alternative might be using an align environment or something similar, but that puts you into math-mode.
    – Tyler
    Oct 23, 2019 at 1:43

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.