emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Footnotes and R output when exporting to HTML or Latex
@ 2009-01-21 15:39 Graham Smith
  2009-01-21 16:32 ` Paul R
  2009-01-29  1:14 ` Dan Davison
  0 siblings, 2 replies; 10+ messages in thread
From: Graham Smith @ 2009-01-21 15:39 UTC (permalink / raw)
  To: emacs-orgmode

Mmmm, so busy concerened about the graphics I didn't realise I had
such a major issue with footnotes.

I am pasting R output into an org file which comes in like:

> names(gq3hazard)

[1] "H1a"    "H1b"    "H1c"    "H2a"    "H2b"    "H2c"    "H3a"    "H3b"

[9] "H3c"    "H3d"    "H4a"    "H4b"    "H4c"    "H5a"    "H5b"    "H5c"

[17] "Htotal"


I suspect some of you are ahead of me, becasue the Org mode export
takes these to be footnotes so in the PDF I get

> names(gq3hazard)
1
"H1a" "H1b" "H1c" "H2a" "H2b" "H2c" "H3a" "H3b"
$ˆ9$ "H3c" "H3d" "H4a" "H4b" "H4c" "H5a" "H5b" "H5c"
$ˆ17$ "Htotal"


with a footnote

1
5 3 7 > library(boot) > medianCI(na.omit(H1b))

I have no idea where the >medianCI bit has come from but looking
through the file, the spurious footnotes seems to be causing havoc
with the layout.


Is it possible to disable the footnote feature and then explicityly
tell orgmode that a specific instance of square brackets should be
interpreted as a footnote.

Thanks,

Graham

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Footnotes and R output when exporting to HTML or Latex
  2009-01-21 15:39 Footnotes and R output when exporting to HTML or Latex Graham Smith
@ 2009-01-21 16:32 ` Paul R
  2009-01-21 16:47   ` Graham Smith
  2009-01-29  1:14 ` Dan Davison
  1 sibling, 1 reply; 10+ messages in thread
From: Paul R @ 2009-01-21 16:32 UTC (permalink / raw)
  To: Graham Smith; +Cc: emacs-orgmode


Graham> Is it possible to disable the footnote feature and then
Graham> explicityly tell orgmode that a specific instance of square
Graham> brackets should be interpreted as a footnote.

Check org-footnote-re and org-footnote-definition-re

-- 
  Paul

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Footnotes and R output when exporting to HTML or Latex
  2009-01-21 16:32 ` Paul R
@ 2009-01-21 16:47   ` Graham Smith
  2009-01-21 17:15     ` [OT] basic emacs tips you will need someday (was: Footnotes and R output when exporting to HTML or Latex) Paul R
  2009-01-21 17:33     ` Re: Footnotes and R output when exporting to HTML or Latex Nick Dokos
  0 siblings, 2 replies; 10+ messages in thread
From: Graham Smith @ 2009-01-21 16:47 UTC (permalink / raw)
  To: Paul R; +Cc: emacs-orgmode

Paul,

> Check org-footnote-re and org-footnote-definition-re

Thanks, but I would appreciate a bit more hand holding on this.

I don't actually know how to "check" org-footnote-re and
org-footnote-definition-re

sorry

Graham

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [OT] basic emacs tips you will need someday (was: Footnotes and R output when exporting to HTML or Latex)
  2009-01-21 16:47   ` Graham Smith
@ 2009-01-21 17:15     ` Paul R
  2009-01-21 17:28       ` Graham Smith
  2009-01-22  3:54       ` Manish Sharma
  2009-01-21 17:33     ` Re: Footnotes and R output when exporting to HTML or Latex Nick Dokos
  1 sibling, 2 replies; 10+ messages in thread
From: Paul R @ 2009-01-21 17:15 UTC (permalink / raw)
  To: Graham Smith; +Cc: emacs-orgmode

Graham,

Graham> Thanks, but I would appreciate a bit more hand holding on this.
Graham> I don't actually know how to "check" org-footnote-re and
Graham> org-footnote-definition-re

I think the best help I can do is to describe the first steps to find
your way in the emacs jungle.

First, take a few minutes to read and try these three commands.

,----[ C-h k C-h k ]
| C-h k runs the command describe-key, which is an interactive compiled
| Lisp function in `help.el'.
| 
| It is bound to C-h k, <f1> k, <help> k, <menu-bar> <help-menu>
| <describe> <describe-key-1>.
| 
| (describe-key &optional key untranslated up-event)
| 
| Display documentation of the function invoked by key.
| key can be any kind of a key sequence; it can include keyboard events,
| mouse events, and/or menu events.  When calling from a program,
| pass key as a string or a vector.
| 
| If non-nil, untranslated is a vector of the corresponding untranslated events.
| It can also be a number, in which case the untranslated events from
| the last key sequence entered are used.
| up-event is the up-event that was discarded by reading key, or nil.
| 
| If key is a menu item or a tool-bar button that is disabled, this command
| temporarily enables it to allow getting help on disabled items and buttons.
| 
| [back]
`----

,----[ C-h k C-h v ]
| C-h v runs the command describe-variable, which is an interactive
| compiled Lisp function in `help-fns.el'.
| 
| It is bound to C-h v, <f1> v, <help> v, <menu-bar> <help-menu>
| <describe> <describe-variable>.
| 
| (describe-variable variable &optional buffer frame)
| 
| Display the full documentation of variable (a symbol).
| Returns the documentation as a string, also.
| If variable has a buffer-local value in buffer or frame
| (default to the current buffer and current frame),
| it is displayed along with the global value.
| 
| [back]
`----

,----[ C-h k C-h f ]
| C-h f runs the command describe-function, which is an interactive
| compiled Lisp function in `help-fns.el'.
| 
| It is bound to C-h f, <f1> f, <help> f, <menu-bar> <help-menu>
| <describe> <describe-function>.
| 
| (describe-function function)
| 
| Display the full documentation of function (a symbol).
| 
| [back]
`----


Now you are ready to discover org-footnote-definition-re and
org-footnote-re. Just press "C-h v org-footnote-re RET" (RET being
enter).

,----[ C-h v org-footnote-re RET ]
| org-footnote-re is a variable defined in `org-footnote.el'.
| Its value is 
| ".\\[\\(?:\\([0-9]+\\)\\|\\(fn:\\([-_[:word:]]+?\\)?\\)\\(?::\\([^]]*?\\)\\)?\\)\\]"
| 
| Documentation:
| Regular expression for matching footnotes.
| 
| [back]
`----

,----[ C-h v org-footnote-definition-re RET ]
| org-footnote-definition-re is a variable defined in `org-footnote.el'.
| Its value is 
| "^\\(\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]\\)"
| 
| Documentation:
| Regular expression matching the definition of a footnote.
| 
| [back]
`----

Right. Now you have a good idea of what those variables are for. 

But wait ! How to guess the names of the variables ?

,----[ C-h f apropos-variable RET ]
| apropos-variable is an interactive compiled Lisp function in
| `apropos.el'.
| 
| It is bound to <menu-bar> <help-menu> <search-documentation>
| <find-options-by-name>.
| 
| (apropos-variable pattern &optional do-all)
| 
| Show user variables that match pattern.
| pattern can be a word, a list of words (separated by spaces),
| or a regexp (using some regexp special characters).  If it is a word,
| search for matches for that word as a substring.  If it is a list of words,
| search for matches for any two (or more) of those words.
| 
| With C-u prefix, or if `apropos-do-all' is non-nil, also show
| normal variables.
| 
| [back]
`----

So calling M-x apropos-variable RET org.*footnote RET will return :

,----[ M-x apropos-variable RET org.*footnote RET ]
| org-export-html-footnotes-section
|   Variable: Format for the footnotes section.
| org-export-with-footnotes
|   Variable: If nil, export [1] as a footnote marker.
| org-footnote-auto-label
|   Variable: Non-nil means, define automatically new labels for footnotes.
| org-footnote-define-inline
|   Variable: Non-nil means, define footnotes inline, at reference location.
| org-footnote-definition-re
|   Variable: Regular expression matching the definition of a footnote.
| org-footnote-fill-after-inline-note-extraction
|   Variable: Non-nil means, fill paragraphs after extracting footnotes.
| org-footnote-label-history
|   Variable: History of footnote labels entered in current buffer.
| org-footnote-re
|   Variable: Regular expression for matching footnotes.
| org-footnote-section
|   Variable: Outline heading containing footnote definitions before export.
| org-footnote-tag-for-non-org-mode-files
|   Variable: Tag marking the beginning of footnote section.
`----

Oh, and org-export-with-footnotes looks interesting also.


How to set all those variables now ? In your emacs session, you probably
have a *scratch* buffer where you can type the emacs lisp language. You
will need the setq function 

,----[ C-h f setq RET ]
| setq is a special form in `C source code'.
| 
| (setq [sym val]...)
| 
| Set each sym to the value of its val.
| The symbols sym are variables; they are literal (not evaluated).
| The values val are expressions; they are evaluated.
| Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'.
| The second val is not computed until after the first sym is set, and so on;
| each val can use the new value of variables set earlier in the `setq'.
| The return value of the `setq' form is the value of the last val.
| 
| [back]
`----

so if you want to set org-export-with-footnotes to nil, type

--8<---------------cut here---------------start------------->8---
(setq org-export-with-footnotes nil) 
--8<---------------cut here---------------end--------------->8---

To evaluate a line in the scratch buffer, go to the last closing paren
and do C-j or C-x C-e. You can immediatly try org exports to see if your
settings are ok.

Once you have find the settings you want for org-mode, you will want to
copy those lisp lines in your ~/.emacs file which is read at emacs
startup.


Want to know how I learned that ?

,----[ C-h f info RET ]
| info is an interactive autoloaded Lisp function in `info.el'.
| 
| It is bound to C-h i, <f1> i, <help> i.
| 
| (info &optional file-or-node buffer)
| 
| Enter Info, the documentation browser.
| Optional argument file-or-node specifies the file to examine;
| the default is the top-level directory of Info.
| Called from a program, file-or-node may specify an Info node of the form
| `(FILENAME)NODENAME'.
| Optional argument buffer specifies the Info buffer name;
| the default buffer name is *info*.  If buffer exists,
| just switch to buffer.  Otherwise, create a new buffer
| with the top-level Info directory.
| 
| In interactive use, a non-numeric prefix argument directs
| this command to read a file name from the minibuffer.
| A numeric prefix argument selects an Info buffer with the prefix number
| appended to the Info buffer name.
| 
| The search path for Info files is in the variable `Info-directory-list'.
| The top-level Info directory is made by combining all the files named `dir'
| in all the directories in that path.
| 
| See a list of available Info commands in `Info-mode'.
| 
| [back]
`----


I hope this does not sounds too much like a stupid RTFM. This was
a RTFM, indeed, but a nice one I hope  :)


-- 
  Paul

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OT] basic emacs tips you will need someday (was: Footnotes and R output when exporting to HTML or Latex)
  2009-01-21 17:15     ` [OT] basic emacs tips you will need someday (was: Footnotes and R output when exporting to HTML or Latex) Paul R
@ 2009-01-21 17:28       ` Graham Smith
  2009-01-22  3:54       ` Manish Sharma
  1 sibling, 0 replies; 10+ messages in thread
From: Graham Smith @ 2009-01-21 17:28 UTC (permalink / raw)
  To: Paul R; +Cc: emacs-orgmode

Paul,

This looks really useful, the problem with the Friendly manual (and I
have the O'Reilly book and the SAMS book) is that its difficult to
know where to start and this very focussed help I am sure will give me
a kick start.

I have now printed it out and will work through it.

Many thanks,

Graham

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: Footnotes and R output when exporting to HTML or Latex
  2009-01-21 16:47   ` Graham Smith
  2009-01-21 17:15     ` [OT] basic emacs tips you will need someday (was: Footnotes and R output when exporting to HTML or Latex) Paul R
@ 2009-01-21 17:33     ` Nick Dokos
  2009-01-21 17:40       ` Graham Smith
  1 sibling, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2009-01-21 17:33 UTC (permalink / raw)
  To: Graham Smith; +Cc: Paul R, emacs-orgmode

Graham Smith <myotisone@gmail.com> wrote:


> > Check org-footnote-re and org-footnote-definition-re
> 
> Thanks, but I would appreciate a bit more hand holding on this.
> 
> I don't actually know how to "check" org-footnote-re and
> org-footnote-definition-re
> 

  C-h v org-footnote-re <RET>

or

  M-x describe-variable <RET> org-footnote-re <RET>

These are the standard Emacs mechanisms for checking variables
(the Help section of the Emacs manual describes these and other similar
mechanisms, e.g. describing functions, keys, etc.)

But I suspect that you are going to run into a much harder wall
after you've done this. The description reads as follows:


---------------------------------------------------------------------------
org-footnote-re is a variable defined in `/home/nick/src/emacs/org/git/org-mode/lisp/org-footnote.elc'.
Its value is 
"[^][\n]\\[\\(?:\\([0-9]+\\)\\|\\(fn:\\([-_[:word:]]+?\\)?\\)\\(?::\\([^]]*?\\)\\)?\\)\\]"

Documentation:
Regular expression for matching footnotes.
---------------------------------------------------------------------------

so you'll need a fair amount of grounding in regular expressions
to even decipher this.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: Footnotes and R output when exporting to HTML or Latex
  2009-01-21 17:33     ` Re: Footnotes and R output when exporting to HTML or Latex Nick Dokos
@ 2009-01-21 17:40       ` Graham Smith
  0 siblings, 0 replies; 10+ messages in thread
From: Graham Smith @ 2009-01-21 17:40 UTC (permalink / raw)
  To: emacs-orgmode

Nick

> But I suspect that you are going to run into a much harder wall
> after you've done this. The description reads as follows:
>
>
> ---------------------------------------------------------------------------
> org-footnote-re is a variable defined in `/home/nick/src/emacs/org/git/org-mode/lisp/org-footnote.elc'.
> Its value is
> "[^][\n]\\[\\(?:\\([0-9]+\\)\\|\\(fn:\\([-_[:word:]]+?\\)?\\)\\(?::\\([^]]*?\\)\\)?\\)\\]"
>
> Documentation:
> Regular expression for matching footnotes.
> ---------------------------------------------------------------------------

Errm yes, my knowledge of reglar expressions is zero, but thanks :-)

Graham

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OT] basic emacs tips you will need someday (was: Footnotes and R output when exporting to HTML or Latex)
  2009-01-21 17:15     ` [OT] basic emacs tips you will need someday (was: Footnotes and R output when exporting to HTML or Latex) Paul R
  2009-01-21 17:28       ` Graham Smith
@ 2009-01-22  3:54       ` Manish Sharma
  2009-01-22  9:13         ` Graham Smith
  1 sibling, 1 reply; 10+ messages in thread
From: Manish Sharma @ 2009-01-22  3:54 UTC (permalink / raw)
  To: emacs-orgmode

Paul R <paul.r.ml@gmail.com> writes:

> Graham,
>
> Graham> Thanks, but I would appreciate a bit more hand holding on this.
> Graham> I don't actually know how to "check" org-footnote-re and
> Graham> org-footnote-definition-re
>
> I think the best help I can do is to describe the first steps to find
> your way in the emacs jungle.
>
[snip: nice helpful introduction to Emacs help (206 lines)]>
>
> I hope this does not sounds too much like a stupid RTFM. This was
> a RTFM, indeed, but a nice one I hope  :)

One of the best introductory materials to Emacs I have come across is a
series of tutorials on IBM DeveloperWorks website at
http://www.ibm.com/developerworks/views/aix/libraryview.jsp?search_by=emacs+editing+environment

Hope someone finds it useful.
-- 
Manish

Life is beautiful.*
* Conditions apply.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [OT] basic emacs tips you will need someday (was: Footnotes and R output when exporting to HTML or Latex)
  2009-01-22  3:54       ` Manish Sharma
@ 2009-01-22  9:13         ` Graham Smith
  0 siblings, 0 replies; 10+ messages in thread
From: Graham Smith @ 2009-01-22  9:13 UTC (permalink / raw)
  To: Manish Sharma; +Cc: emacs-orgmode

Manish,

I will have a look at this. Thansk fro the pointer.

Graham

2009/1/22 Manish Sharma <mailtomanish.sharma@gmail.com>:
> Paul R <paul.r.ml@gmail.com> writes:
>
>> Graham,
>>
>> Graham> Thanks, but I would appreciate a bit more hand holding on this.
>> Graham> I don't actually know how to "check" org-footnote-re and
>> Graham> org-footnote-definition-re
>>
>> I think the best help I can do is to describe the first steps to find
>> your way in the emacs jungle.
>>
> [snip: nice helpful introduction to Emacs help (206 lines)]>
>>
>> I hope this does not sounds too much like a stupid RTFM. This was
>> a RTFM, indeed, but a nice one I hope  :)
>
> One of the best introductory materials to Emacs I have come across is a
> series of tutorials on IBM DeveloperWorks website at
> http://www.ibm.com/developerworks/views/aix/libraryview.jsp?search_by=emacs+editing+environment
>
> Hope someone finds it useful.
> --
> Manish
>
> Life is beautiful.*
> * Conditions apply.
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Footnotes and R output when exporting to HTML or Latex
  2009-01-21 15:39 Footnotes and R output when exporting to HTML or Latex Graham Smith
  2009-01-21 16:32 ` Paul R
@ 2009-01-29  1:14 ` Dan Davison
  1 sibling, 0 replies; 10+ messages in thread
From: Dan Davison @ 2009-01-29  1:14 UTC (permalink / raw)
  To: Graham Smith; +Cc: emacs-orgmode

On Wed, Jan 21, 2009 at 03:39:36PM +0000, Graham Smith wrote:
> Mmmm, so busy concerened about the graphics I didn't realise I had
> such a major issue with footnotes.
> 
> I am pasting R output into an org file which comes in like:
> 
> > names(gq3hazard)
> 
> [1] "H1a"    "H1b"    "H1c"    "H2a"    "H2b"    "H2c"    "H3a"    "H3b"
> 
> [9] "H3c"    "H3d"    "H4a"    "H4b"    "H4c"    "H5a"    "H5b"    "H5c"
> 
> [17] "Htotal"

Hi Graham,

An alternative might be to format output like this as an org table?
As Tom Short pointed out in another thread, you can use org-tblR.el
(was org-table-R.el) in a trivial way to do that without any
copy/pasting. For example you could use any of the following

||
#+TBLRR: x <- names(gq3hazard)

||
#+TBLRR: x <- t(names(gq3hazard))

||
#+TBLRR: x <- cbind(seq(length(gq3hazard)), names(gq3hazard))

With point in the #+TBLRR line, org-tblR-apply produces respectively


|        |
|--------|
| H1a    |
| H1b    |
| H1c    |
| H2a    |
| H2b    |
| H2c    |
| H3a    |
| H3b    |
| H3c    |
| H3d    |
| H4a    |
| H4b    |
| H4c    |
| H5a    |
| H5b    |
| H5c    |
| Htotal |
#+TBLRR: x <- names(gq3hazard)

|     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |        |
|-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--------|
| H1a | H1b | H1c | H2a | H2b | H2c | H3a | H3b | H3c | H3d | H4a | H4b | H4c | H5a | H5b | H5c | Htotal |
#+TBLRR: x <- t(names(gq3hazard))

|    |        |
|----+--------|
|  1 | H1a    |
|  2 | H1b    |
|  3 | H1c    |
|  4 | H2a    |
|  5 | H2b    |
|  6 | H2c    |
|  7 | H3a    |
|  8 | H3b    |
|  9 | H3c    |
| 10 | H3d    |
| 11 | H4a    |
| 12 | H4b    |
| 13 | H4c    |
| 14 | H5a    |
| 15 | H5b    |
| 16 | H5c    |
| 17 | Htotal |
#+TBLRR: x <- cbind(seq(length(gq3hazard)), names(gq3hazard))

Dan

http://www.stats.ox.ac.uk/~davison/software/org-tbl-R/org-tblR.el

(NB The code now uses TBLRR: instead of TBLR::)

p.s. [Explanation if required/interested : TBLRR lines contain R code
that create an R variable called `x' that gets output to the org
buffer as an org table. In these cases a degenerate org table (||) is
provided, and the R code doesn't use it when creating the variable
x. For non-R users: "<-" is the assignment operator in R (you can also
use "="), cbind sticks two vectors together column-wise, t is the
transpose function.]





> 
> 
> I suspect some of you are ahead of me, becasue the Org mode export
> takes these to be footnotes so in the PDF I get
> 
> > names(gq3hazard)
> 1
> "H1a" "H1b" "H1c" "H2a" "H2b" "H2c" "H3a" "H3b"
> $??9$ "H3c" "H3d" "H4a" "H4b" "H4c" "H5a" "H5b" "H5c"
> $??17$ "Htotal"
> 
> 
> with a footnote
> 
> 1
> 5 3 7 > library(boot) > medianCI(na.omit(H1b))
> 
> I have no idea where the >medianCI bit has come from but looking
> through the file, the spurious footnotes seems to be causing havoc
> with the layout.
> 
> 
> Is it possible to disable the footnote feature and then explicityly
> tell orgmode that a specific instance of square brackets should be
> interpreted as a footnote.
> 
> Thanks,
> 
> Graham
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

-- 
http://www.stats.ox.ac.uk/~davison

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-01-29  1:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-21 15:39 Footnotes and R output when exporting to HTML or Latex Graham Smith
2009-01-21 16:32 ` Paul R
2009-01-21 16:47   ` Graham Smith
2009-01-21 17:15     ` [OT] basic emacs tips you will need someday (was: Footnotes and R output when exporting to HTML or Latex) Paul R
2009-01-21 17:28       ` Graham Smith
2009-01-22  3:54       ` Manish Sharma
2009-01-22  9:13         ` Graham Smith
2009-01-21 17:33     ` Re: Footnotes and R output when exporting to HTML or Latex Nick Dokos
2009-01-21 17:40       ` Graham Smith
2009-01-29  1:14 ` Dan Davison

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).