Re: #+INCLUDE causes error when it attmepts to expand a LaTeX macro in source block

2019-12-08 Thread Nicolas Goaziou
Hello,

Charles Millar  writes:

> In my init file I have
>
> (setq org-confirm-babel-evaluate nil)

This is totally unrelated to inclusion, see below.

> File "A" is attached as an org file. I evaluate the source blocks (C-c 
> C-v s), the table is generated and then I export it to PDF. The source 
> blocks do not evaluate during export.
>
> In file B I have
>
> #+INCLUDE: "/path/to/FileA::*SCHEDULE A1112"
>
> When I attempt to export File B to PDF/LaTeX the following error occurs
>
> Debugger entered--Lisp error: (error "Undefined Org macro: cmhfill; 
> aborting")
>signal(error ("Undefined Org macro: cmhfill; aborting"))
>error("Undefined Org macro: %s; aborting" "cmhfill")
>

[...]

> Also, please note that the cmhfill macro is in the table headings.

This is the problem, IMO.

> Is this an error, i.e. the #+INCLUDE does not honor the setting in my 
> init file?

Generally speaking, INCLUDE does not honor any Babel related setting
because inclusion happens before almost anything else (e.g., Babel)
during the export process.

But I don't think this is related to your issue.

> Is there a header or property setting for File B to prevent the exporter 
> from evaluating the source blocks when executing through an #+INCLUDE, 
> more particularly to prevent the attempted macro expansion within the 
> source blocks?

Org does not expand within source blocks. It tried to expand macro in
your table header, but cannot find the macro definitions.
>
> Both File A and File B had identical LaTeX settings, i.e. the macro was 
> defined in both files.

Where is it defined? I cannot see it.

Regards,

-- 
Nicolas Goaziou



#+INCLUDE causes error when it attmepts to expand a LaTeX macro in source block

2019-12-07 Thread Charles Millar

Greetings,

In my init file I have

(setq org-confirm-babel-evaluate nil)

File "A" is attached as an org file. I evaluate the source blocks (C-c 
C-v s), the table is generated and then I export it to PDF. The source 
blocks do not evaluate during export.


In file B I have

#+INCLUDE: "/path/to/FileA::*SCHEDULE A1112"

When I attempt to export File B to PDF/LaTeX the following error occurs

Debugger entered--Lisp error: (error "Undefined Org macro: cmhfill; 
aborting")

  signal(error ("Undefined Org macro: cmhfill; aborting"))
  error("Undefined Org macro: %s; aborting" "cmhfill")

If I place a "#+HEADER: :eval no" in the source blocks in File A (after 
generating the table) File B will export the table to PDF. Also, please 
note that the cmhfill macro is in the table headings.


Is this an error, i.e. the #+INCLUDE does not honor the setting in my 
init file?


Is there a header or property setting for File B to prevent the exporter 
from evaluating the source blocks when executing through an #+INCLUDE, 
more particularly to prevent the attempted macro expansion within the 
source blocks?


Both File A and File B had identical LaTeX settings, i.e. the macro was 
defined in both files.


GNU Emacs 27.0.50 (build 8, x86_64-pc-linux-gnu, GTK+ Version 3.24.13) 
of 2019-12-07


Org mode version 9.3 (release_9.3-36-gbe7434 @ 
/usr/local/share/org-mode/lisp/)


Charlie Millar
* SCHEDULE A1112
#+NAME: SCHEDAP
#+begin_src rec :data somefile.rec :type Finance :fields 
AccountDate,Shares,Description,AccountAmount :sort AccountDate,Description 
:results silent
 (File = 'Estate' && AccountSchedule = 'A')
#+end_src
#+RESULTS: SCHEDAP
#+NAME: SCHEDA
#+begin_src emacs-lisp :var table=SCHEDAP :exports results
  (setq table (cons 'hline table))
  (setq table (cons '("Date" "{{{cmhfill}}} Shares" " Description " 
"{{{cmhfill}}} Inventory{{{cm1space}}}Value") table))
  (setq table (append table '(("| |Total Schedule A"
  (setq table (append table '(("\n#+TBLFM: @>$>=vsum(@I$>..@>>$>);%.2f::"
  table
#+end_src
#+ATTR_LATEX: :mode table :environment longtable :align  
p{60pt}N{5}{3}p{275pt}N{8}{2}
#+RESULTS: SCHEDA
| Date   | {{{cmhfill}}} Shares | Description  | {{{cmhfill}}} 
Inventory{{{cm1space}}}Value |
|+--+--+|
| 2018-03-18 |  | Something|
   49645.59 |
| etc|  | etc  |
4878.51 |
||  | Total Schedule A |
   54524.10 |
#+TBLFM: @>$>=vsum(@I$>..@>>$>);%.2f:: |