简体   繁体   中英

Org-mode beamer - How to create a short title, author, date?

有没有简单的方法在.org文件中添加简短的标题,作者,日期等,而不会搞乱生成的.tex文件?

My (in progress) Org Beamer refcard could help you.

See on https://github.com/fniessen/refcard-org-beamer , in particular the section "Creating a title page".

UPDATE -- Something like the following would do it?

#+BIND: org-latex-title-command "\\title{De leerplandoelstellingen}\n\\date[mei 2014]{9 mei 2014}\n\\maketitle"

(that's a way to fiddle with the title, but directly from the Org file...)

Yes you can define #+SHORT_TITLE but it involves editing 2 elisp files. You need to find your ox.el and ox-beamer.el files, mine are located in the ~/.emacs.d/elpa/org-20150330 directory. There are also some compiled files ox.elc and ox-beamer.elc . I recommend you create a backup of all these files before continuing.

In file ox.el go to line 118 and add the short_title line as shown below:

 114│    (:section-numbers nil "num" org-export-with-section-numbers)
 115│    (:select-tags "SELECT_TAGS" nil org-export-select-tags split)
 116│    (:time-stamp-file nil "timestamp" org-export-time-stamp-file)
 117│    (:title "TITLE" nil nil space)
 118│    (:short_title "SHORT_TITLE" nil nil space) ;; Additional line        
 119│    (:with-archived-trees nil "arch" org-export-with-archived-trees)
 120│    (:with-author nil "author" org-export-with-author)
 121│    (:with-clocks nil "c" org-export-with-clocks)
 122│    (:with-creator nil "creator" org-export-with-creator)

Save the file. Remove th ox.elc file (ensure you have a backup) and byte compile the file. This can be done from within emacs using Mx byte-compile-file and entering the file name, ensure it completes without error.

Then open file ox-beamer.el and make the following changes.

 860│     ;; 7. Title
 861│     (let ((short_title (plist-get info :short_title)))
 862│       (format "\\title[%s]{%s}\n" short_title title))

Save, remove the old ox-beamer.elc and byte compile. Restart emacs and you can now use #+SHORT_TITLE: as you wish.

Your line numbers may be different but I've included the surrounding code so you should be able to find/replace easily.

I use this to achieve the same effect:

#+TITLE: Short title
#+BEAMER_HEADER: \subtitle{long title}

This requires that you make the too title play well together, so it does not look silly.

Credit: Learnt about the BEAMER_HEADER thing from https://github.com/fniessen/refcard-org-beamer

I understand this is an old question. I got here while searching for a solution to the same problem. And I thought others in the same boat may benefit from a cleaner solution.

Including the following before/after #+TITLE: should do the job:

#+BEAMER_HEADER: \title[short title]{long title}

Note that it replaces whatever you set in the #TITLE: line. Of course, I'm not sure if this was a possibility at the time OP asked the question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM