3
votes

Is it possible to completely disable the title, i.e. not even \title{}, when export org file to latex? I am using org mode to write paper the latex template provided by the publisher does not allow \title{} command appears before \begin{document}

I tried many solutions found online but neither of them works with the latex template I am using. Currently, I put #+BIND: org-latex-title-command " in my org file. From the source code in ox-latex, I found the following code inside org-latex-template (contents info):

     ;; Title and subtitle.
     (let* ((subtitle (plist-get info :subtitle))
        (formatted-subtitle
         (when subtitle
           (format (plist-get info :latex-subtitle-format)
               (org-export-data subtitle info))))
        (separate (plist-get info :latex-subtitle-separate)))
       (concat
    (format "\\title{%s%s}\n" title
        (if separate "" (or formatted-subtitle "")))
    (when (and separate subtitle)
      (concat formatted-subtitle "\n"))))

Does this mean that there is no way to get rid of the \title{} command in the exported latex file?

Thanks for your assistance!

1

1 Answers

5
votes

I came up with this little advice function that removes the \title{...} line from the output:

(defun my-org-latex-remove-title (str)
  (replace-regexp-in-string "^\\\\title{.*}$" "" str))

(advice-add 'org-latex-template :filter-return 'my-org-latex-remove-title)