This message can be read easier with Org Mode.
* TL; DR: The issue I've noticed that the =:prologue= and =:epilogue= header arguments don't work in code blocks whose language is =latex=. I usually take notes on the =latex= programming language (this is different than taking notes using LaTeX) and having those header arguments would be really helpful for me and, I suppose, other LaTeX programmers. The following lines of this message give more detail on the issue and more information I gathered through experimentation so that Org Mode developers that might be interested in fixing this issue have more information. * Terminology used in this message The following two code blocks will be used to explain the issue. #+begin_src elisp (defun org-babel-tangle-previous-src-block-and-echo () "Tangles the backward nearest source code block and print the content of the tangled file." (save-excursion (goto-char (search-backward-regexp "^[[:space:]]*#\\+begin_src\\>")) (let ((current-prefix-arg '(4))) (call-interactively 'org-babel-tangle)) (let ((filename-tangled (shell-quote-argument (expand-file-name (cdr (assq :tangle (nth 2 (org-babel-get-src-block-info)))))))) (shell-command-to-string (concat "cat " filename-tangled))))) #+end_src #+name: org-babel-tangle-previous-src-block-and-echo #+begin_src elisp (org-babel-tangle-previous-src-block-and-echo) #+end_src * Languages where these header argument work The =:prologue= and =:epilogue= header argument work in =bash= code blocks. #+begin_src bash :tangle ~/Downloads/main.txt :prologue "echo a" :epilogue "echo c" echo This is a bash code block #+end_src #+RESULTS: #+begin_example a This is a bash code block c #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example #!/bin/bash echo a echo This is a bash code block echo c #+end_example They also work in =python= code blocks. #+begin_src python :tangle ~/Downloads/main.txt :prologue "print('a')" :epilogue "print('c')" print('This is a python code block') #+end_src #+RESULTS: #+begin_example a This is a python code block c #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example print('a') print('This is a python code block') print('c') #+end_example They also work in =R= code blocks. #+begin_src R :tangle ~/Downloads/main.txt :prologue "print('a')" :epilogue "print('b')" print('This is a R code block') #+end_src #+RESULTS: #+begin_example [1] "a" [1] "This is a R code block" [1] "b" #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example print('a') print('This is a R code block') print('b') #+end_example They also work in =maxima= code blocks. #+begin_src maxima :tangle ~/Downloads/main.txt :prologue "print(\"a\");" :epilogue "print(\"c\");" print("This is a maxima code block"); #+end_src #+RESULTS: #+begin_example a This is a maxima code block c #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example print("a"); print("This is a maxima code block"); print("c"); #+end_example * Languages where these header arguments don't work However, these header argument don't work in =latex= code blocks. #+begin_src latex :tangle ~/Downloads/main.txt :prologue "a" :epilogue "c" This is a latex code block #+end_src #+RESULTS: #+begin_example This is a latex code block #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example This is a latex code block #+end_example They also don't work in =cpp= code blocks #+begin_src cpp :tangle ~/Downloads/main.txt :prologue "a" :epilogue "b" :includes "<iostream>" std::cout << "This is a C++ code block"; #+end_src #+RESULTS: #+begin_example This is a C++ code block #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example #include <iostream> int main() { std::cout << "This is a C++ code block"; return 0; } #+end_example * Additional information In 2020, the user Tim Landscheidt created a [[https://orgmode.org/list/ca+g3_pnrdhx0ejzw8uo7dgz+ju1b7ar_etch5mmviepkgwq...@mail.gmail.com/T/#t][thread]] in the Org Mode mailing list asking why these header argument don't work in SQL code blocks. In a response to this thread, the user Tom Gillespie mentioned that he had been working in a potential solution. If anyone knows the progress on this, I would also apppreciate some information. -- Greetings, Rodrigo Morales.