Re: [O] [bug] Export to latex truncates long subsections (WE attached)

2019-08-27 Thread Julius Dittmar
Hi folks,

Am 27.08.19 um 08:57 schrieb Vladimir Nikishkin:
> I have indeed investigated the issue, and this is the link:
> https://latex.org/forum/viewtopic.php?f=47&t=32788
>
> To make the long story short, the folowing trick is needed to allow
> page breaks after headings (which is a completely standard case in
> -org).
>
> #+begin_src latex
> \usepackage{xpatch}
> \makeatletter
> % This is not recommended, because it can break several things
> \xpatchcmd{\@afterheading}{\@nobreaktrue}{\@nobreakfalse}{%
> \typeout{WARNING: \string\@afterheading\space broken}%
> }{%
> \@latexerr{ERROR: Cannot patch \string\@afterheading}\@ehd%
> }
> \makeatother
> #+end_src
>
> Shall this trick be considered for inclusion in 'org' officially?
> I mean, having lists of empty headings is a perfectly standard use case for 
> org.

I would not want that as the default. Yes, it is one standard use case.
It would break other standard use cases, like creating ordinary
documents, though.

Perhaps variant adding such a patch could be added to org-latex-classes,
or at least mentioned in the docs to org-latex-classes? That way you can
use this "class" version for such cases without adding unnecessary
uglyness to other org-created documents.

Another possible approach would be a change in the export functions.
What really is needed here, from my point of view, is that the export
adds a superficial paragraph to a heading in the case that there's no
content at all. Nothing should be added if the heading has sub-headings,
I count that as content. In case there is no content at all, then some
form of breakable vertical space should be added. I don't know enough
LaTeX to find the least intrusive way, though I'd try \vspace{0pt}.

I did never dig into the export functions, so I don't know how difficult
that would be.

Just my thoughts,
Julius Dittmar



Re: [O] [bug] Export to latex truncates long subsections (WE attached)

2019-08-27 Thread Tim Cross


I think I agree with Julius. While it may be a legitimate use case, the
risk that it will break other use cases seems a bit high (I've never run
into this issue in many years of org use).

Perhaps add another document 'type' into 'org-latex-classes which adds
the xpatch and associated change to the default. I have a number of such
'templates' (e.g. to generate work documents with the 'approved' colours
and logo etc). It works quite well.

Tim


Julius Dittmar  writes:

> Hi folks,
>
> Am 27.08.19 um 08:57 schrieb Vladimir Nikishkin:
>> I have indeed investigated the issue, and this is the link:
>> https://latex.org/forum/viewtopic.php?f=47&t=32788
>>
>> To make the long story short, the folowing trick is needed to allow
>> page breaks after headings (which is a completely standard case in
>> -org).
>>
>> #+begin_src latex
>> \usepackage{xpatch}
>> \makeatletter
>> % This is not recommended, because it can break several things
>> \xpatchcmd{\@afterheading}{\@nobreaktrue}{\@nobreakfalse}{%
>> \typeout{WARNING: \string\@afterheading\space broken}%
>> }{%
>> \@latexerr{ERROR: Cannot patch \string\@afterheading}\@ehd%
>> }
>> \makeatother
>> #+end_src
>>
>> Shall this trick be considered for inclusion in 'org' officially?
>> I mean, having lists of empty headings is a perfectly standard use case for 
>> org.
>
> I would not want that as the default. Yes, it is one standard use case.
> It would break other standard use cases, like creating ordinary
> documents, though.
>
> Perhaps variant adding such a patch could be added to org-latex-classes,
> or at least mentioned in the docs to org-latex-classes? That way you can
> use this "class" version for such cases without adding unnecessary
> uglyness to other org-created documents.
>
> Another possible approach would be a change in the export functions.
> What really is needed here, from my point of view, is that the export
> adds a superficial paragraph to a heading in the case that there's no
> content at all. Nothing should be added if the heading has sub-headings,
> I count that as content. In case there is no content at all, then some
> form of breakable vertical space should be added. I don't know enough
> LaTeX to find the least intrusive way, though I'd try \vspace{0pt}.
>
> I did never dig into the export functions, so I don't know how difficult
> that would be.
>
> Just my thoughts,
> Julius Dittmar


--
Tim Cross



[O] Fold headline from inside of body?

2019-08-27 Thread henry35
Hello

Is it possible to fold a headline (and only this specific headline) while the 
cursor is positioned inside the body?
The methods I know of ( [TAB] ) requires that the cursor is positioned on the 
headline, (Shift-[TAB] acts on the whole org-file and I want to avoid folding 
the entire document).
Thanks for your help.


Re: [O] Fold headline from inside of body?

2019-08-27 Thread Nicolas Goaziou
Hello,

 writes:

> Is it possible to fold a headline (and only this specific headline) while the 
> cursor is positioned inside the body?
> The methods I know of ( [TAB] ) requires that the cursor is positioned on the 
> headline, (Shift-[TAB] acts on the whole org-file and I want to avoid folding 
> the entire document).

Well, `C-c C-p TAB' does that. :)

You can bind it to something else if you absolutely need to make it
shorter.

Regards,

-- 
Nicolas Goaziou



Re: [O] minimal testing setup for pdf export?

2019-08-27 Thread Matt Price
My empty.tex is very similar:

% Created 2019-08-27 Tue 06:25
% 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}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 27.0.50 (Org mode 9.1.9)},
 pdflang={English}}
\begin{document}

\tableofcontents

\end{document}

Th pdf is still not being produced:

org-compile-file: File "/home/matt/empty.pdf" wasn’t produced.  See "*Org
PDF LaTeX Output*" for details

Org LDF LaTeX Output says:


This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch Linux)
(preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
! I can't find file `empty.tex'.
<*> empty.tex

(Press Enter to retry, or Control-D to exit)
Please type another input file name
! Emergency stop.
<*> empty.tex

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on .//texput.log.


However, empty.tex is clearly present.  Latex and pdflatex are both in my
$PATH.

Maybe this is a problem with pdflatex?


On Tue, Aug 27, 2019 at 2:14 AM Robert Klein  wrote:

> On Mon, 26 Aug 2019 21:20:53 -0400
> Matt Price  wrote:
>
> > Can someone point me to a minimal setup for testing PDF export with
> > "emacs -Q"? I am unable to produce a pdf with default settings and I
> > am pretty sure  that the latex is invalid... but I'm having trouble
> > testing it since I 9still) know so little about latex.
> >
> > Thanks everyone!
> >
> > Matt
>
> What is in your *messages* buffer after the export attempt?
>
> Whats the result when you export a blank “empty.org” file to LaTeX (C-c
> C-e l l)? I get
>
> --- snip ---
> % Created 2019-08-27 Tue 08:10
> % 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{Robert Klein}
> \date{\today}
> \title{}
> \hypersetup{
>  pdfauthor={Robert Klein},
>  pdftitle={},
>  pdfkeywords={},
>  pdfsubject={},
>  pdfcreator={Emacs 26.2 (Org mode 9.1.9)},
>  pdflang={English}}
> \begin{document}
>
> \tableofcontents
>
> \end{document}
> --- snip ---
>
> Just in case, do you have latex/pdflatex installed and in your path?
>
> Best regards
> Robert
>


Re: [O] minimal testing setup for pdf export?

2019-08-27 Thread Julius Dittmar
Am 27.08.19 um 12:34 schrieb Matt Price:
> This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch
> Linux) (preloaded format=pdflatex)
>  restricted \write18 enabled.
> entering extended mode
> ! I can't find file `empty.tex'.

So pdflatex is called and found. Then pdflatex can't find empty.tex.
That looks like pdflatex is called in another directory than where
empty.tex resides. How that could happen, no idea.

Julius



Re: [O] minimal testing setup for pdf export?

2019-08-27 Thread John Kitchin
Can you manually compile the empty.tex file from the command line? eg

pdflatex empty

John

---
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Tue, Aug 27, 2019 at 7:57 AM Julius Dittmar 
wrote:

> Am 27.08.19 um 12:34 schrieb Matt Price:
> > This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch
> > Linux) (preloaded format=pdflatex)
> >  restricted \write18 enabled.
> > entering extended mode
> > ! I can't find file `empty.tex'.
>
> So pdflatex is called and found. Then pdflatex can't find empty.tex.
> That looks like pdflatex is called in another directory than where
> empty.tex resides. How that could happen, no idea.
>
> Julius
>
>


Re: [O] minimal testing setup for pdf export?

2019-08-27 Thread Matt Price
On Tue, Aug 27, 2019 at 8:27 AM John Kitchin 
wrote:

> Can you manually compile the empty.tex file from the command line? eg
>
> pdflatex empty
>
> (reposting to group)

pdflatex empty

Seems to work fine. Hmmm...

> John
>
> ---
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Tue, Aug 27, 2019 at 7:57 AM Julius Dittmar 
> wrote:
>
>> Am 27.08.19 um 12:34 schrieb Matt Price:
>> > This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch
>> > Linux) (preloaded format=pdflatex)
>> >  restricted \write18 enabled.
>> > entering extended mode
>> > ! I can't find file `empty.tex'.
>>
>> So pdflatex is called and found. Then pdflatex can't find empty.tex.
>> That looks like pdflatex is called in another directory than where
>> empty.tex resides. How that could happen, no idea.
>>
>> Julius
>>
>>


Re: [O] minimal testing setup for pdf export?

2019-08-27 Thread John Kitchin
that does suggest that pdflatex is getting called somewhere else.

Maybe you can edebug the export function and check the value of
default-directory to see where it is getting called.

You could also try this

#+BEGIN_SRC emacs-lisp
(defun my-build (quoted-tex-file)
  (message "Building %s. Called from %s" quoted-tex-file default-directory))

(setq org-latex-pdf-process 'my-build)
#+END_SRC

It won't build the pdf, but it will tell you in the messages where it was
called from. It might help figure out what is happening.
John

---
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Tue, Aug 27, 2019 at 8:57 AM Matt Price  wrote:

>
>
> On Tue, Aug 27, 2019 at 8:27 AM John Kitchin 
> wrote:
>
>> Can you manually compile the empty.tex file from the command line? eg
>>
>> pdflatex empty
>>
>> (reposting to group)
>
> pdflatex empty
>
> Seems to work fine. Hmmm...
>
>> John
>>
>> ---
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>>
>>
>>
>> On Tue, Aug 27, 2019 at 7:57 AM Julius Dittmar 
>> wrote:
>>
>>> Am 27.08.19 um 12:34 schrieb Matt Price:
>>> > This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch
>>> > Linux) (preloaded format=pdflatex)
>>> >  restricted \write18 enabled.
>>> > entering extended mode
>>> > ! I can't find file `empty.tex'.
>>>
>>> So pdflatex is called and found. Then pdflatex can't find empty.tex.
>>> That looks like pdflatex is called in another directory than where
>>> empty.tex resides. How that could happen, no idea.
>>>
>>> Julius
>>>
>>>


Re: [O] minimal testing setup for pdf export?

2019-08-27 Thread Matt Price
On Tue, Aug 27, 2019 at 1:33 PM John Kitchin 
wrote:

> that does suggest that pdflatex is getting called somewhere else.
>
> Maybe you can edebug the export function and check the value of
> default-directory to see where it is getting called.
>
> You could also try this
>
> #+BEGIN_SRC emacs-lisp
> (defun my-build (quoted-tex-file)
>   (message "Building %s. Called from %s" quoted-tex-file
> default-directory))
>
> (setq org-latex-pdf-process 'my-build)
> #+END_SRC
>
> It won't build the pdf, but it will tell you in the messages where it was
> called from. It might help figure out what is happening.
>

huh.  that was kinda cool... but the value of default-directory seems to be
correct.  However, this helped a bit:

#+BEGIN_SRC emacs-lisp
(shell-command-to-string "echo $PWD")

#+END_SRC


#+RESULTS:
: /home/matt/src/org-mode

Not sure what's going on here, but this value is the same in a regular
emacs and  "emacs -Q".  is this normal?


John
>
> ---
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Tue, Aug 27, 2019 at 8:57 AM Matt Price  wrote:
>
>>
>>
>> On Tue, Aug 27, 2019 at 8:27 AM John Kitchin 
>> wrote:
>>
>>> Can you manually compile the empty.tex file from the command line? eg
>>>
>>> pdflatex empty
>>>
>>> (reposting to group)
>>
>> pdflatex empty
>>
>> Seems to work fine. Hmmm...
>>
>>> John
>>>
>>> ---
>>> Professor John Kitchin
>>> Doherty Hall A207F
>>> Department of Chemical Engineering
>>> Carnegie Mellon University
>>> Pittsburgh, PA 15213
>>> 412-268-7803
>>> @johnkitchin
>>> http://kitchingroup.cheme.cmu.edu
>>>
>>>
>>>
>>> On Tue, Aug 27, 2019 at 7:57 AM Julius Dittmar 
>>> wrote:
>>>
 Am 27.08.19 um 12:34 schrieb Matt Price:
 > This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch
 > Linux) (preloaded format=pdflatex)
 >  restricted \write18 enabled.
 > entering extended mode
 > ! I can't find file `empty.tex'.

 So pdflatex is called and found. Then pdflatex can't find empty.tex.
 That looks like pdflatex is called in another directory than where
 empty.tex resides. How that could happen, no idea.

 Julius




[O] ob-clojure can't cross source block handle :var in :noweb source block

2019-08-27 Thread numbch...@gmail.com
I have bellowing example:
```org
#+NAME: read-in-wxid
#+begin_src clojure :var cwd=(file-truename "~/Documents/WeChat/wxid/")
(require '[clojure.java.io :as io])

(def directory (io/file cwd))
(def files (filter #(.isFile %) (file-seq directory)))
#+end_src

#+RESULTS[<2019-08-28 09:12:24> 84a1210d836742ca71c776aaebba0e0224af]:
read-in-wxid
: #'user/files

#+begin_src clojure :noweb yes :results pp
<>
(take 3 files)
#+end_src

#+RESULTS[<2019-08-28 09:12:30> 9bbcd9f779f72bdd9b7bb8fb85aa36bbdfee7e3c]:
: class clojure.lang.Compiler$CompilerExceptionclass
clojure.lang.Compiler$CompilerExceptionSyntax error compiling at (*Org Src
Code.org[ clojure ]*:3:16).
: Unable to resolve symbol: cwd in this context
```

You can see it can't resole first source block's `:var` definition.

I'm using:
- GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.8) of
2019-04-13
- Org mode version 9.2.1 (release_9.2.1-274-ge3b7c3.dirty @
/home/stardiviner/Code/Emacs/org-mode/lisp/)

[stardiviner] GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/