[O] Feature request: export vertical/horizontal table lines in math mode [9.0 (release_9.0-16-g8826f2 @ /Users/stefanos/org-mode/lisp/)]

2016-11-06 Thread Stefanos Carlström
In a previous version of Org [Emacs 24.4.90.2 (Org mode 8.2.10)
according to an old PDF I have], I could export an Org table as a matrix
in math mode and divide the matrix into sub-blocks with the alignment
string and \hline's. The former is no longer possible in the HEAD
version of Org. This works fine, in normal mode, both
vertical/horizontal dividers exported:

#+ATTR_LATEX: :align c|c
| a | b |
|---+---|
| c | d |

exports to

\begin{center}
\begin{tabular}{c|c}
a & b\\
\hline
c & d\\
\end{tabular}
\end{center}

whereas

#+ATTR_LATEX: :mode math :environment array :align c|c :math-prefix 
A=\left[ :math-suffix \right],
| a | b |
|---+---|
| \hline{}c | d |

exports to

\[
A=\left[\begin{array}{cc}
 a & b \\
 \hline{}c & d \\
\end{array}\right],
\]

First off, I would like the vertical dividing line back. If I could also
(maybe via an option) get the horizontal line without manually adding
the \hline, it would be fantastic!

Cheers,
Stefanos

Emacs  : GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 
10.9.5 (Build 13F1911))
 of 2016-09-21
Package: Org mode version 9.0 (release_9.0-16-g8826f2 @ 
/Users/stefanos/org-mode/lisp/)

current state:
==
(setq
 org-hide-leading-stars t
 org-pandoc-epub-rights "Copyright 2016 Stefanos Carlström <>"
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 outline-minor-mode-hook '(outshine-hook-function)
 org-latex-classes '(("beamer" "\\documentclass[presentation]{beamer}"
  ("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("article" "\\documentclass[11pt]{article}"
  ("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
  ("\\paragraph{%s}" . "\\paragraph*{%s}")
  ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
 ("report" "\\documentclass[11pt]{report}"
  ("\\part{%s}" . "\\part*{%s}")
  ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("book" "\\documentclass[11pt]{book}"
  ("\\part{%s}" . "\\part*{%s}")
  ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("landau-book" "\\documentclass[11pt]{book}"
  ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 )
 org-speed-command-hook '(org-speed-command-default-hook
  org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-format-latex-options '(:foreground default :background default :scale 2
:html-foreground "Black" :html-background
"Transparent" :html-scale 1.0 :matchers
("begin" "$1" "$" "$$" "\\(" "\\["))
 org-latex-format-inlinetask-function 
'org-latex-format-inlinetask-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-latex-pdf-process '("latexmk -pdflatex='pdflatex -shell-escape' -pdf %f")
 org-preview-latex-default-process 'imagemagick
 org-babel-clojure-backend 'cider
 org-latex-format-headline-function 'org-latex-format-headline-default-funct

Re: [O] Bug: ox-latex math in headings export error [8.3.6 (release_8.3.6-1257-g33f8f8 @ /Users/stefanos/org-mode/lisp/)]

2016-10-28 Thread Stefanos Carlström
Thanks!

Den fre 28 okt. 2016 15:48Nicolas Goaziou <m...@nicolasgoaziou.fr> skrev:

> Hello,
>
> Stefanos Carlström <stefanos.carlst...@gmail.com> writes:
>
> > Exporting a simple document such as
> >
> >   * Section heading with math \(\pi\) bug
> >
> > with ox-latex on HEAD gives the attached output, which does not compile,
> > due to the newline in the exported heading.
>
> [...]
>
> >   \section{Section heading with math \(\pi\)
> >
> >   bug}
>
> Fixed. Thank you.
>
> Regards,
>
> --
> Nicolas Goaziou
>


[O] Bug: ox-latex math in headings export error [8.3.6 (release_8.3.6-1257-g33f8f8 @ /Users/stefanos/org-mode/lisp/)]

2016-10-28 Thread Stefanos Carlström
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Exporting a simple document such as

  * Section heading with math \(\pi\) bug

with ox-latex on HEAD gives the attached output, which does not compile,
due to the newline in the exported heading.

  % Created 2016-10-28 Fri 12:31
  % Intended LaTeX compiler: pdflatex
  \documentclass[11pt]{article}
  \usepackage[utf8]{inputenc}
  \usepackage[T1]{fontenc}
  \usepackage{graphicx}
  \usepackage{grffile}
  \usepackage{longtable}
  \usepackage{wrapfig}
  \usepackage{rotating}
  \usepackage[normalem]{ulem}
  \usepackage{amsmath}
  \usepackage{textcomp}
  \usepackage{amssymb}
  \usepackage{capt-of}
  \usepackage{hyperref}
  \author{Stefanos Carlström}
  \date{\today}
  \title{}
  \hypersetup{
   pdfauthor={Stefanos Carlström},
   pdftitle={},
   pdfkeywords={},
   pdfsubject={},
   pdfcreator={Emacs 25.1.1 (Org mode 8.3.6)}, 
   pdflang={English}}
  \begin{document}
  
  \tableofcontents
  
  \section{Section heading with math \(\pi\)
  
  bug}
  \label{sec:org16a7736}
  \end{document}
  
  which does not compile.
  
  Emacs  : GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 
Version 10.9.5 (Build 13F1911))
   of 2016-09-21
  Package: Org mode version 8.3.6 (release_8.3.6-1257-g33f8f8 @ 
/Users/stefanos/org-mode/lisp/)
  
  current state:
  ==
  (setq
   org-hide-leading-stars t
   org-pandoc-epub-rights "Copyright 2016 Stefanos Carlström <>"
   org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
   outline-minor-mode-hook '(outshine-hook-function)
   org-latex-classes '(("beamer" "\\documentclass[presentation]{beamer}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
   ("article" "\\documentclass[11pt]{article}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
   ("report" "\\documentclass[11pt]{report}"
("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
   ("book" "\\documentclass[11pt]{book}"
("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
   ("landau-book" "\\documentclass[11pt]{book}"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
   )
   org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
   org-occur-hook '(org-first-headline-recenter)
   org-metaup-hook '(org-babel-load-in-session-maybe)
   org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
   org-format-latex-options '(:foreground default :background default :scale 2
  :html-foreground "Black" :html-background 
"Transparent"
  :html-scale 1.0 :matchers
  ("begin" "$1" "$" "$$" "\\(" "\\["))
   org-latex-format-inlinetask-function 
'org-latex-format-inlinetask-def

[O] [PATCH] Added possibility of overriding PGF inclusion command

2016-07-26 Thread Stefanos Carlström
* ox-latex.el (org-latex--inline-image): The user can now customize the
  way PGF images are included by changing the (new) variable
  `org-latex-inline-pgf-command'.

If the PGF file is stored in a subdirectory and references an external
image file in the same directory, LaTeX will complain about not finding
it.  A workaround could be to define a function like this in the
preamble:

\newcommand\inputpgf[2]{{
\let\pgfimageWithoutPath\pgfimage
\renewcommand{\pgfimage}[2][]{\pgfimageWithoutPath[##1]{#1/##2}}
\input{#1/#2}
  }}

and customizing `org-latex-inline-pgf-command' to hold this function:

(lambda (path)
  (let ((dir-name (substring (file-name-directory path) 0 -1))
(file-name (file-name-nondirectory path)))
(format "\\inputpgf{%s}{%s}" dir-name file-name)))

This way, LaTeX will be able to find the external images.  The idea came
from here: http://tex.stackexchange.com/a/282110/9742

TINYCHANGE
---
 lisp/ox-latex.el | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 0901726..419f608 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -730,6 +730,19 @@ default we use here encompasses both."
   :type '(alist :key-type (string :tag "Type")
:value-type (regexp :tag "Path")))
 
+(defcustom org-latex-inline-pgf-command
+  (lambda (path) (format "\\input{%s}" path))
+  "Function used to include PGF images as links. By default, the
+pgf images is included with a simple \input{file.pgf} command,
+but the user might want to redefine this behaviour, if the pgf
+file is stored in a subdirectory, and it references external
+image files, as is the case when saving to PGF format from
+matplotlib. The user can then specify a LaTeX command that takes
+care of providing the correct search path for the external
+dependencies, by redefining \pgfimage suitably."
+  :group 'org-export-latex
+  :type 'function)
+
 (defcustom org-latex-link-with-unknown-path-format "\\texttt{%s}"
   "Format string for links with unknown path type."
   :group 'org-export-latex
@@ -2300,12 +2313,12 @@ used as a communication channel."
 image-code)
 (if (member filetype '("tikz" "pgf"))
;; For tikz images:
-   ;; - use \input to read in image file.
+   ;; - use \input (default, can be overridden) to read in image file.
;; - if options are present, wrap in a tikzpicture environment.
;; - if width or height are present, use \resizebox to change
;;   the image size.
(progn
- (setq image-code (format "\\input{%s}" path))
+ (setq image-code (funcall org-latex-inline-pgf-command path))
  (when (org-string-nw-p options)
(setq image-code
  (format "\\begin{tikzpicture}[%s]\n%s\n\\end{tikzpicture}"
-- 
2.7.4 (Apple Git-66)