Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 83e4f2f6 authored by AGULLO Emmanuel's avatar AGULLO Emmanuel
Browse files

Merge branch 'modular' into 'master'

Reinforce the modular of compose-publish, notably including support for styles and themes

See merge request !2
parents 6c9696a6 87d6455b
No related branches found
No related tags found
1 merge request!2Reinforce the modular of compose-publish, notably including support for styles and themes
Pipeline #744657 failed
[submodule "compose-styles"]
path = compose-styles
url = https://gitlab.inria.fr/compose/include/compose-styles.git
[submodule "compose-themes"]
path = compose-themes
url = https://gitlab.inria.fr/compose/include/compose-themes.git
......@@ -20,6 +20,51 @@
;; Override the default LaTeX publishing command.
(setq org-latex-pdf-process (list "latexmk --shell-escape -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f"))
(with-eval-after-load 'ox-latex
(add-to-list 'org-latex-classes
'("compas2021"
"\\documentclass{compas2021}
\\usepackage{hyperref}
[NO-DEFAULT-PACKAGES]
[EXTRA]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))))
(with-eval-after-load 'ox-latex
(add-to-list 'org-latex-classes
'("IEEEtran"
"\\documentclass{IEEEtran}
\\usepackage{hyperref}
[NO-DEFAULT-PACKAGES]
[EXTRA]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))))
(with-eval-after-load 'ox-latex
(add-to-list 'org-latex-classes
'("llncs"
"\\documentclass{llncs}
\\usepackage{hyperref, wrapfig}
[NO-DEFAULT-PACKAGES]
[EXTRA]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))))
(with-eval-after-load 'ox-latex
(add-to-list 'org-latex-classes
'("siamart220329"
"\\documentclass{siamart220329}
\\usepackage[utf8]{inputenc}
\\usepackage[T1]{fontenc}
[NO-DEFAULT-PACKAGES]
[EXTRA]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))))
;; Load languages for code block evaluation.
(org-babel-do-load-languages
'org-babel-load-languages
......@@ -154,26 +199,80 @@ To solve this problem, when your code only knows the relative path of another fi
(setcar (nthcdr 1 org-emphasis-regexp-components) "[:alpha:]- \t.,:!?;'\")}\\")
(org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)
;; Custom publishing function for LaTeX files. This is useful when we need to
;; publish a manually written LaTeX file to PDF (e. g. a poster).
(defun latex-publish-to-pdf (plist filename pub-dir)
(let
;; Keep the initial directory.
((cwd default-directory))
;; Navigate to the directory of the LaTeX file to publish.
(cd (file-name-directory filename))
;; Call the interal publishing function.
(org-latex-compile filename)
;; Publish the PDF file to the destination set in the project's alist.
(org-publish-attachment
plist
(concat (file-name-sans-extension filename) ".pdf")
pub-dir)
;; Return to the initial directory.
(cd cwd)))
;; Verbose errors for pdf generation
;; https://www.pank.eu/blog/blog-setup.html
;; Note: we use /dev/tty instead of /dev/stdout: https://stackoverflow.com/questions/16747449/runuser-permission-denied-on-dev-stdout
;; Note: 2022/12/20: We shall even use "$(tty)" for more portability (thanks Antoine Jego)
(defun org-latex-publish-to-pdf-verbose-on-error (plist filename pub-dir)
(condition-case nil
(condition-case err
(org-latex-publish-to-pdf
plist filename pub-dir)
;; Handle Org errors at first.
(user-error
(message "%s" (error-message-string err)))
;; If the Org source is fine, handle LaTeX errors.
(error
(with-current-buffer "*Org PDF LaTeX Output*"
(message (buffer-string))))))
(defun org-beamer-publish-to-pdf-verbose-on-error (plist filename pub-dir)
(condition-case nil
(condition-case err
(org-beamer-publish-to-pdf
plist filename pub-dir)
;; Handle Org errors at first.
(user-error
(message "%s" (error-message-string err)))
;; If the Org source is fine, handle LaTeX errors.
(error
(with-current-buffer "*Org PDF LaTeX Output*"
(message (buffer-string))))))
(defun org-babel-execute-file (plist filename pub-dir)
;; A custom publishing function for executing all Babel source code blocks in
;; the Org file `filename'. Note that the function does not actually publish
;; anything to `pub-dir'.
(progn
(find-file filename)
(org-babel-execute-buffer)
(set-buffer-modified-p nil)
(kill-buffer)))
(defun execute-block-in-file (block file)
;; Executes the named source code `block' in `file' without altering the
;; latter.
(progn
(find-file file)
(org-babel-goto-named-src-block block)
(org-babel-execute-src-block)
(set-buffer-modified-p nil)
(kill-buffer)))
(defun disable-babel (&optional project-plist)
;; Disable Babel code evaluation.
(setq org-export-babel-evaluate nil))
(defun enable-babel (&optional project-plist)
;; Enable Babel code evaluation.
(setq org-export-babel-evaluate t))
;; Use timestamp to avoid publishing
(setq org-publish-use-timestamps-flag t)
......
Subproject commit 6442d7f14f392036276bf025913a2d44b73d1b0b
Subproject commit 6cdf82dc34d9244a694e26169365856c426ec24b
# -*- mode: org; -*-
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="https://mfelsoci.gitlabpages.inria.fr/inria-org-html-themes/readtheorginria/css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="https://mfelsoci.gitlabpages.inria.fr/inria-org-html-themes/readtheorginria/css/readtheorginria.css"/>
#+HTML_HEAD: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="https://mfelsoci.gitlabpages.inria.fr/inria-org-html-themes/lib/js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="https://mfelsoci.gitlabpages.inria.fr/inria-org-html-themes/readtheorginria/js/readtheorginria.js"></script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment