Re: [O] can't get table output when running r babel

2018-08-09 Thread Zhihao Ding
Hi Chuck and Robert,

Thanks for your replies. I am able to get it working on an independent
installation.
It looks like something has gone wrong in my package installations.
I guess it's probably time to nuke my repo and start over, already spent
quite a lot of
time debugging this particular error.

Thanks again,
Zhihao



On Thu, Aug 9, 2018 at 6:32 AM Robert Klein  wrote:

> On Wed, 8 Aug 2018 16:10:10 +0100
> Zhihao Ding  wrote:
>
> > Hi there,
> >
> > I can't seem to get a table output from running this toy example:
> >
> >#+HEADER: :results value
> > #+BEGIN_SRC R
> >   data <- data.frame(list(a=c(1,2,3), b=c(4,5,6)))
> >   data
> > #+END_SRC
> >
> > #+RESULTS:
> >
> > The problem seems to be
> > org-babel-insert-result: Wrong type argument: markerp, nil
> >
> > I see that the value of org-field-marker is nil in org-table.el.
> >
> > I am using this version of org:
> > Org mode version 9.1.13 (9.1.13-elpa @
> > /home/user/.emacs.d/elpa/org-20180806/)
> >
> > If anyone could advise it'd be great.
> >
> > Thanks,
> > Zhihao
>
>
> Hi Zhihao,
>
> I als get
>
> #+RESULTS:
> | 1 | 4 |
> | 2 | 5 |
> | 3 | 6 |
>
>
> using
> "GNU Emacs 26.1 (build 3, x86_64-unknown-openbsd6.3, GTK+ Version 2.24.32)
>  of 2018-05-30"
> Org mode version 9.1.13 (release_9.1.13-5-g30498e @
> /home/roklein/.emacs.d/org-mode/lisp/)
>
> My org version is up-to-date “maint”, your elpa version should be up to
> date, too (“20180806”).
>
> What ist your Emacs version?  Do you also encounter the issue with a
> minimal Emacs/Org setup?
>
> Best regards
> Robert
>
>
>
>
>
>


[O] can't get table output when running r babel

2018-08-08 Thread Zhihao Ding
Hi there,

I can't seem to get a table output from running this toy example:

   #+HEADER: :results value
#+BEGIN_SRC R
  data <- data.frame(list(a=c(1,2,3), b=c(4,5,6)))
  data
#+END_SRC

#+RESULTS:

The problem seems to be
org-babel-insert-result: Wrong type argument: markerp, nil

I see that the value of org-field-marker is nil in org-table.el.

I am using this version of org:
Org mode version 9.1.13 (9.1.13-elpa @
/home/user/.emacs.d/elpa/org-20180806/)

If anyone could advise it'd be great.

Thanks,
Zhihao


Re: [O] insert evaluation results in place

2018-03-28 Thread Zhihao Ding
Thank you!

Zhihao


On Wed, Mar 28, 2018 at 4:28 PM Berry, Charles  wrote:

>
>
> > On Mar 28, 2018, at 7:42 AM, Zhihao Ding  wrote:
> >
> > I was wondering if anyone could share an example for referencing the
> results of a source code block in place.
> >
>
>
> See
>
> (info "(org) Evaluating code blocks")
>
> Example
>
>
> #+Name: put_in_para
> #+BEGIN_SRC R :exports none
> n_value=10
> n_value
> #+END_SRC
>
>
> This is the result: call_put_in_para() of the above.
>
> HTH,
>
> Chuck
>


[O] insert evaluation results in place

2018-03-28 Thread Zhihao Ding
Hi there,

I was wondering if anyone could share an example for referencing the
results of a source code block in place.

For example, a source code block could be defined as below

  #+HEADER: n_value
  #+HEADER: :results value
  #+HEADER: :noweb yes
  #+BEGIN_SRC R
n_value=10
n_value
  #+END_SRC

and I want to insert the result value after evaluation into a paragraph of
text.

I currently evaluate the source code block first, then copy the stuff under
"#+RESULTS:" to the target location. I want to make it in one go,
especially when the output is just a single number.

Thank you,

Zhihao


Re: [O] environmental variables in links in org

2015-11-16 Thread Zhihao Ding
Thanks for your reply. I found controlling the environment outside org is
much better and stopped thinking this direction.

Cheers,
Zhihao


On 15 November 2015 at 14:03, Grant Rettke  wrote:

> On Thu, Nov 5, 2015 at 7:16 PM, Zhihao Ding  wrote:
> > Is it a good idea to use environment variables in the links referenced
> in a
> > org file?  e.g.
> >
> > [[$mydata/myfigure.pdf]]
>
> How do you want Org to behave when the user clicks the link?
>
> > If so how to achieve this?
>
> I would try in-line source blocks.
>



-- 
Regards,
Zhihao Ding


[O] environmental variables in links in org

2015-11-05 Thread Zhihao Ding
Hi guys,

Is it a good idea to use environment variables in the links referenced in a
org file?  e.g.

[[$mydata/myfigure.pdf]]

If so how to achieve this?

Many thanks,
Zhihao


Re: [O] :EXPORT tags in property drawer not recognised in org 8.3

2015-10-05 Thread Zhihao Ding
Thanks Rasmus. After some exploration I realised that I can't have empty
lines or comment lines (by #) between :PROPERTIES: and :END: - I used to
have blocks of :EXPORT_ for different things. Once I remove those I get the
right export as before. This is fixed for me now.

Thanks,
Zhihao

On 29 September 2015 at 21:54, Rasmus  wrote:

> Hi Zhihao,
>
> Zhihao Ding  writes:
>
> > Dear Org experts,
> >
> > I am having some problems with exporting in org 8.3.1. I've been using
> > :PROPERTIES to control export of a heading, e.g.
> >
> > :PROPERTIES:
> > :EXPORT_LaTeX_HEADER+: \usepackage{array}
> > :EXPORT_LaTeX_HEADER+: \usepackage{tikz}
> > :EXPORT_LATEX_HEADER+: \usepackage{geometry}
> > :EXPORT_TITLE: title
> > :EXPORT_FILE_NAME: file.pdf
> > :END:
> >
> > However I realised that they are not correctly recognised in the latex
> > output. Any advice?
>
>
> Could you be more specific about what is wrong? In a quick test I got the
> requested packages and title.
>
> Could you try 8.3.2 or master to see if the problem persists.
>
> Thanks,
> Rasmus
>
> --
> ツ
>
>
>


-- 
Regards,
Zhihao Ding


[O] :EXPORT tags in property drawer not recognised in org 8.3

2015-09-29 Thread Zhihao Ding
Dear Org experts,

I am having some problems with exporting in org 8.3.1. I've been using
:PROPERTIES to control export of a heading, e.g.

:PROPERTIES:
:EXPORT_LaTeX_HEADER+: \usepackage{array}
:EXPORT_LaTeX_HEADER+: \usepackage{tikz}
:EXPORT_LATEX_HEADER+: \usepackage{geometry}
:EXPORT_TITLE: title
:EXPORT_FILE_NAME: file.pdf
:END:

However I realised that they are not correctly recognised in the latex
output. Any advice?

Thanks,
Zhihao


Re: [O] compile latex on remote server

2015-09-07 Thread Zhihao Ding
My emacs session is local and I am using tramp to open the org file on the
remote server. Then when I tried to export it to latex and compile I get
that error messages.

Cheers,
Zhihao


On 7 September 2015 at 14:39, Loris Bennett 
wrote:

> Hi Zhihao,
>
> Zhihao Ding  writes:
>
> > Thanks for your reply. In export if I do "l P" or "l O" I get the follow
> > messages
> >
> > Transcript written on .//texput.log.
> > This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
> > restricted \write18 enabled.
> > entering extended mode
> > ! I can't find file `/ssh:zhihao@server:/data/home/zhihao/sgt.tex'.
>
> Is this file created on the remote server?  If so, can you open it in
> Emacs via tramp?
>
> Cheers,
>
> Loris
>
>
> > <*>  server:/data/home/zhihao/sgt.tex
> > (Press Enter to retry, or Control-D to exit)
> > Please type another input file name
> > ! Emergency stop.
> > <*>  server:/data/home/zhihao/sgt.tex
> > ! ==> Fatal error occurred, no output PDF file produced!
> >
> > On 7 September 2015 at 14:14, Loris Bennett 
> wrote:
> >
> > Hi Zhihao,
> >
> >
> >
> > Zhihao Ding  writes:
> >
> > > Dear org experts,
> > >
> > > I'm working on an org file on a remote server using tramp. Often I
> need to
> > > export beamer slides from it. I realised that it has problems with
> the
> > file
> > > paths, which currently are local with respect to the server. I
> thus had to
> > first
> > > export a tex file, which worked fine over tramp, then compile it
> in a
> > shell on
> > > the server.
> > >
> > > I'd like to speed this up to do the process in one go, as if I am
> working
> > on a
> > > local machine. Sometimes when the latex file has references I then
> had to
> > > compile one extra time for bibtex, which soon became tedious.
> > >
> > > Thanks !
> >     >
> > > Zhihao
> >
> >
> > What errors are you getting? I regularly export PDFs from remote org
> > files (albeit via sshfs) and have no problems.
> >
> > Cheers,
> >
> > Loris
> >
> > --
> > This signature is currently under construction.
>
> --
> Dr. Loris Bennett (Mr.)
> ZEDAT, Freie Universität Berlin Email loris.benn...@fu-berlin.de
>
>
>


-- 
Regards,
Zhihao Ding


Re: [O] compile latex on remote server

2015-09-07 Thread Zhihao Ding
Thanks for your reply. In export if I do "l P" or "l O" I get the follow
messages


Transcript written on .//texput.log.
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
 restricted \write18 enabled.
entering extended mode
! I can't find file `/ssh:zhihao@server:/data/home/zhihao/sgt.tex'.
<*>  server:/data/home/zhihao/sgt.tex

(Press Enter to retry, or Control-D to exit)
Please type another input file name
! Emergency stop.
<*>  server:/data/home/zhihao/sgt.tex

!  ==> Fatal error occurred, no output PDF file produced!


On 7 September 2015 at 14:14, Loris Bennett 
wrote:

> Hi Zhihao,
>
> Zhihao Ding  writes:
>
> > Dear org experts,
> >
> > I'm working on an org file on a remote server using tramp. Often I need
> to
> > export beamer slides from it. I realised that it has problems with the
> file
> > paths, which currently are local with respect to the server. I thus had
> to first
> > export a tex file, which worked fine over tramp, then compile it in a
> shell on
> > the server.
> >
> > I'd like to speed this up to do the process in one go, as if I am
> working on a
> > local machine. Sometimes when the latex file has references I then had to
> > compile one extra time for bibtex, which soon became tedious.
> >
> > Thanks !
> >
> > Zhihao
>
> What errors are you getting?  I regularly export PDFs from remote org
> files (albeit via sshfs) and have no problems.
>
> Cheers,
>
> Loris
>
> --
> This signature is currently under construction.
>
>
>


-- 
Regards,
Zhihao Ding


[O] compile latex on remote server

2015-09-07 Thread Zhihao Ding
Dear org experts,

I'm working on an org file on a remote server using tramp. Often I need to
export beamer slides from it. I realised that it has problems with the file
paths, which currently are local with respect to the server. I thus had to
first export a tex file, which worked fine over tramp, then compile it in a
shell on the server.

I'd like to speed this up to do the process in one go, as if I am working
on a local machine. Sometimes when the latex file has references I then had
to compile one extra time for bibtex, which soon became tedious.

Thanks !

Zhihao


[O] remote R session

2015-08-11 Thread Zhihao Ding
Hi there,

I was wondering how to automatically fire up a remote R session when
editing source code in babel source code block? I'd like to have everything
on server and be able to play with it including making plots. Currently I
do tangle to a file on server first and then use tramp to access it.
Although I get a remote R session, the problem is that I'll be working on a
generated copy. Any ways to make improve this ?

Thanks,
Zhihao


Re: [O] problem with beamer slides

2015-08-06 Thread Zhihao Ding
I have solved this problem. It's a problem with latex not org. Thanks for
replying to this.

Cheers,
Zhihao

On 6 August 2015 at 13:20, Zhihao Ding  wrote:

> I export the subtree, below is the org, and after that is the latex
>
> ===
>
> * projects
>
> :PROPERTIES:
> :header-args: :cache yes
> :EXPORT_DATE: \today
> :EXPORT_AUTHOR: myname
> :EXPORT_LaTeX_HEADER+: \usepackage{array}
> :EXPORT_LaTeX_HEADER+: \usepackage{tikz}
> :EXPORT_LATEX_HEADER+: \usepackage[margin=1in]{geometry}
> :EXPORT_LaTeX_HEADER+: \usepackage{algpseudocode}
> :EXPORT_LaTeX_HEADER+: \usepackage[extendedchars]{grffile}
> :EXPORT_LaTeX_HEADER+: \usepackage[T1]{fontenc}
> :EXPORT_TITLE: my title
> :EXPORT_FILE_NAME: mypdf.pdf
> :EXPORT_OPTIONS: H:3 toc:nil *:t ^:nil :t
> :EXPORT_LaTeX_CLASS: beamer
> :EXPORT_SELECT_TAGS: export
> :EXPORT_EXCLUDE_TAGS: noexport
>
> :END:
>
>
> ** Data
> *** Test
>  Slide
>  - item
>
>
> ===
>
>
> % Created 2015-08-06 Thu 13:20
> \documentclass[presentation]{beamer}
> \usepackage[utf8]{inputenc}
> \usepackage[T1]{fontenc}
> \usepackage{fixltx2e}
> \usepackage{graphicx}
> \usepackage{longtable}
> \usepackage{float}
> \usepackage{wrapfig}
> \usepackage{rotating}
> \usepackage[normalem]{ulem}
> \usepackage{amsmath}
> \usepackage{textcomp}
> \usepackage{marvosym}
> \usepackage{wasysym}
> \usepackage{amssymb}
> \usepackage{hyperref}
> \tolerance=1000
> \usepackage{array} \usepackage{tikz} \usepackage[margin=1in]{geometry}
> \usepackage{algpseudocode} \usepackage[extendedchars]{grffile}
> \usepackage[T1]{fontenc}
> \author{myname}
> \date{\today}
> \title{my title}
> \hypersetup{
>   pdfkeywords={},
>   pdfsubject={},
>   pdfcreator={Emacs 24.4.1 (Org mode 8.2.10)}}
> \begin{document}
>
> \maketitle
>
>
> \section{Data}
> \label{sec-1}
> \subsection{Test}
> \label{sec-1-1}
> \subsubsection{Slide}
> \label{sec-1-1-1}
> \begin{itemize}
> \item item
> \end{itemize}
> % Emacs 24.4.1 (Org mode 8.2.10)
> \end{document}
>
>
>
>
>
>
> On 6 August 2015 at 12:27, Eric S Fraga  wrote:
>
>> On Thursday,  6 Aug 2015 at 12:15, Zhihao Ding wrote:
>> > Hi guys,
>> >
>> > I had some problems producing beamer slides after I installed emacs and
>> org
>> > on a new computer. I am using emacs 24.4.1, and installed org (8.2.10
>> > org-2018-08-03) using elpa.
>> >
>> > I don't seem to be able to get the frame environment even when I set the
>> > "H" in the options, e.g.
>> >
>> > :EXPORT_OPTIONS: H:3 toc:nil *:t ^:nil :t
>> >
>> > It just gets to subsubsection and then stop. Any idea how to fix this?
>> > Thanks a lot!
>>
>> How are you exporting?  Can you post a small example file?
>>
>> --
>> : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org
>> release_8.3beta-1315-ga3b2b7
>>
>
>
>
> --
> Regards,
> Zhihao Ding
>



-- 
Regards,
Zhihao Ding


Re: [O] problem with beamer slides

2015-08-06 Thread Zhihao Ding
I export the subtree, below is the org, and after that is the latex

===

* projects

:PROPERTIES:
:header-args: :cache yes
:EXPORT_DATE: \today
:EXPORT_AUTHOR: myname
:EXPORT_LaTeX_HEADER+: \usepackage{array}
:EXPORT_LaTeX_HEADER+: \usepackage{tikz}
:EXPORT_LATEX_HEADER+: \usepackage[margin=1in]{geometry}
:EXPORT_LaTeX_HEADER+: \usepackage{algpseudocode}
:EXPORT_LaTeX_HEADER+: \usepackage[extendedchars]{grffile}
:EXPORT_LaTeX_HEADER+: \usepackage[T1]{fontenc}
:EXPORT_TITLE: my title
:EXPORT_FILE_NAME: mypdf.pdf
:EXPORT_OPTIONS: H:3 toc:nil *:t ^:nil :t
:EXPORT_LaTeX_CLASS: beamer
:EXPORT_SELECT_TAGS: export
:EXPORT_EXCLUDE_TAGS: noexport

:END:


** Data
*** Test
 Slide
 - item


===


% Created 2015-08-06 Thu 13:20
\documentclass[presentation]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{amssymb}
\usepackage{hyperref}
\tolerance=1000
\usepackage{array} \usepackage{tikz} \usepackage[margin=1in]{geometry}
\usepackage{algpseudocode} \usepackage[extendedchars]{grffile}
\usepackage[T1]{fontenc}
\author{myname}
\date{\today}
\title{my title}
\hypersetup{
  pdfkeywords={},
  pdfsubject={},
  pdfcreator={Emacs 24.4.1 (Org mode 8.2.10)}}
\begin{document}

\maketitle


\section{Data}
\label{sec-1}
\subsection{Test}
\label{sec-1-1}
\subsubsection{Slide}
\label{sec-1-1-1}
\begin{itemize}
\item item
\end{itemize}
% Emacs 24.4.1 (Org mode 8.2.10)
\end{document}






On 6 August 2015 at 12:27, Eric S Fraga  wrote:

> On Thursday,  6 Aug 2015 at 12:15, Zhihao Ding wrote:
> > Hi guys,
> >
> > I had some problems producing beamer slides after I installed emacs and
> org
> > on a new computer. I am using emacs 24.4.1, and installed org (8.2.10
> > org-2018-08-03) using elpa.
> >
> > I don't seem to be able to get the frame environment even when I set the
> > "H" in the options, e.g.
> >
> > :EXPORT_OPTIONS: H:3 toc:nil *:t ^:nil :t
> >
> > It just gets to subsubsection and then stop. Any idea how to fix this?
> > Thanks a lot!
>
> How are you exporting?  Can you post a small example file?
>
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org
> release_8.3beta-1315-ga3b2b7
>



-- 
Regards,
Zhihao Ding


[O] problem with beamer slides

2015-08-06 Thread Zhihao Ding
Hi guys,

I had some problems producing beamer slides after I installed emacs and org
on a new computer. I am using emacs 24.4.1, and installed org (8.2.10
org-2018-08-03) using elpa.

I don't seem to be able to get the frame environment even when I set the
"H" in the options, e.g.

:EXPORT_OPTIONS: H:3 toc:nil *:t ^:nil :t

It just gets to subsubsection and then stop. Any idea how to fix this?
Thanks a lot!

-- 
Regards,
Zhihao Ding


Re: [O] resize table in latex

2015-06-02 Thread Zhihao Ding
Thanks. This idea works, based on which I used the following 
in the end. 

#+NAME: tbl:lab
#+ATTR_LATEX: :caption \caption[short]{\label{tbl:lab} long.} 
\scriptsize{\resizebox{\textwidth}{!} \centering

It does’t look very org like but is good that it works.

Thanks, 
Zhihao


> On 2 Jun 2015, at 10:06, Suvayu Ali  wrote:
> 
> 
> 
> On Tue, Jun 02, 2015 at 08:43:07AM +0000, Zhihao Ding wrote:
>> Thanks very much for your reply. The proposed method 
>> in this reply won’t work. It needs to be in the following
>> structure where this line 
>> 
>> “\scriptsize{\resizebox{\textwidth}{!}{“
>> 
>> is after “\begin{table}[htb]” and immediately before 
>> “\begin{tabular}{rr}”. 
> 
> Why is that?  Is it because table is a float?
> 
> You could try repurposing the :caption attribute.  See: 
> 
>  (info "(org) LaTeX specific attributes")
> 
> Hope this helps,
> 
> -- 
> Suvayu
> 
> Open source is the future. It sets us free.



Re: [O] resize table in latex

2015-06-02 Thread Zhihao Ding
Thanks very much for your reply. The proposed method 
in this reply won’t work. It needs to be in the following
structure where this line 

 “\scriptsize{\resizebox{\textwidth}{!}{“

is after “\begin{table}[htb]” and immediately before 
“\begin{tabular}{rr}”. 

I don’t know how to achieve that in the org syntax. 

\begin{table}[htb]
\caption[caption]{\label{tablelabel} caption}
\centering

\scriptsize{\resizebox{\textwidth}{!}{
\begin{tabular}{rr}
1 & 4 \\
\end{tabular}
}}

\end{table}

Thanks, 
Zhihao


> On 1 Jun 2015, at 17:35, Suvayu Ali  wrote:
> 
> On Mon, Jun 01, 2015 at 10:51:24AM +, Zhihao Ding wrote:
>> Hi there, 
>> 
>> I am trying to find a way to automatically resize tables
>> in the latex output.
>> 
>> When doing slides in beamer, I use this to resize tables 
>> to fit in a frame
>> 
>> #+LaTeX: \scriptsize{\resizebox{\textwidth}{!}{
>>  | . | . |
>> #+LaTeX: }}
>> 
>> While when writing reports, I use the following instead 
>> as I need to cross reference it by the name
>> 
>> #+CAPTION: table caption
>> #+NAME: table:label
>>  | . | . |
>> 
>> then I loose the resize facility.  How could I combine 
>> the two? I tried to fiddle with 
>> #+ATTR_LATEX but didn’t mange to make it work. 
> 
> I don't follow.  Why do you say you lose the facility?  The following:
> 
>  #+LaTeX: \scriptsize{\resizebox{\textwidth}{!}{
>  #+CAPTION: table caption
>  #+NAME: table:label
> | . | . |
> | . | . |
>  #+LaTeX: }}
> 
> exports as:
> 
>  \scriptsize{\resizebox{\textwidth}{!}{
>  \begin{table}[htb]
>  \caption{\label{tab:orgtable1}
>  table caption}
>  \centering
>  \begin{tabular}{ll}
>  . & .\\
>  . & .\\
>  \end{tabular}
>  \end{table}
>  }}
> 
> Isn't that exactly what you want?
> 
> -- 
> Suvayu
> 
> Open source is the future. It sets us free.



[O] resize table in latex

2015-06-01 Thread Zhihao Ding
Hi there, 

I am trying to find a way to automatically resize tables
in the latex output.

When doing slides in beamer, I use this to resize tables 
to fit in a frame

 #+LaTeX: \scriptsize{\resizebox{\textwidth}{!}{
| . | . |
 #+LaTeX: }}

While when writing reports, I use the following instead 
as I need to cross reference it by the name

 #+CAPTION: table caption
 #+NAME: table:label
| . | . |

then I loose the resize facility.  How could I combine 
the two? I tried to fiddle with 
#+ATTR_LATEX but didn’t mange to make it work. 

Thanks very much!

Zhihao



Re: [O] float control in org

2015-05-22 Thread Zhihao Ding
Thanks a lot Rasmus. 

Zhihao

> On 22 May 2015, at 11:07, Rasmus  wrote:
> 
> Zhihao Ding  writes:
> 
>> Hi there, 
>> 
>> Could I ask for some advice on using the latex float 
>> package in org mode? I’d like to have some control on 
>> the positions of the figures, tables, code blocks etc. 
>> Currently I am doing it using latex entirely, just for 
>> my code blocks, as below 
>> 
>> #+BEGIN_LaTeX
>> \floatstyle{ruled}
>> \newfloat{Program}{tbp}{lop}[section]
>> \begin{Program}
>> \begin{verbatim}
>>  ./somescripts.sh someargs
>> \end{verbatim}
>> \caption{my caption}
>> \label{mylabel}
>> \end{Program}
>> #+END_LaTeX
>> 
>> There must be better ways of doing this?
> 
> Maybe something like this
> 
> #+latex_header: \floatstyle{ruled}
> #+latex_header: \newfloat{program}{tbp}{lop}[section]
> 
> #+caption: my program
> #+begin_program
> #+BEGIN_SRC sh
> ./somescripts.sh someargs
> #+END_SRC
> #+end_program
> 
> —Rasmus
> 
> -- 
> It was you, Jezebel, it was you



[O] float control in org

2015-05-22 Thread Zhihao Ding
Hi there, 

Could I ask for some advice on using the latex float 
package in org mode? I’d like to have some control on 
the positions of the figures, tables, code blocks etc. 
Currently I am doing it using latex entirely, just for 
my code blocks, as below 

 #+BEGIN_LaTeX
 \floatstyle{ruled}
 \newfloat{Program}{tbp}{lop}[section]
 \begin{Program}
 \begin{verbatim}
./somescripts.sh —someargs
 \end{verbatim}
 \caption{my caption}
 \label{mylabel}
 \end{Program}
 #+END_LaTeX

 There must be better ways of doing this?

Thanks very much!

Zhihao

Re: [O] position figures side by side in PDF output

2015-05-21 Thread Zhihao Ding
Thanks a lot Andreas and Rasmus! 
The solution using the subcaption package works best for me. 

Best, 
Zhihao



> On 20 May 2015, at 22:03, Andreas Leha  
> wrote:
> 
> Hi Zhihao,
> 
> Rasmus  writes:
>> Hi Zhihao,
>> 
>> Zhihao Ding  writes:
>> 
>>> Could anyone give me some advice on how to position figures side by side in 
>>> PDF output?
>>> I am trying to write a report, while my figures were all originally 
>>> produced individually.  I’d like 
>>> to put them, mostly two, sometimes three, side by side sharing a same 
>>> caption and label. 
>>> Below is the syntax I am using now, which can only do one figure. 
>> 
>> Does this thread answer your question?  It would give you individual
>> subcaptions, but you need not use them.
>> 
>> https://lists.gnu.org/archive/html/emacs-orgmode/2014-11/msg00548.html
>> 
>> Otherwise you could use e.g. imagemagick to stick together figures.
>> 
> 
> As an alternative you could use a table.
> + easy
> + orgmode only (should work across backends)
> - no scaling of images
> - it is a table for latex (i.e. will appear in list of tables, etc.)
> 
> Here is a short example for the table approach and an imagemagick-based
> solution as proposed by Rasmus.
> 
> 
> --8<---cut here---start->8---
> * generate images:noexport:
> #+name: image1
> #+begin_src R :results graphics :file img1.pdf
>  plot(1:10)
> #+end_src
> 
> #+results: image1
> [[file:img1.pdf]]
> 
> #+name: image2
> #+begin_src R :results graphics :file img2.pdf
>  plot(1:5)
> #+end_src
> 
> #+results: image2
> [[file:img2.pdf]]
> 
> * export side-by-side
> 
> ** table
> #+caption: stitching side-by-side using tables
> | [[file:img1.pdf]] | [[file:img2.pdf]] |
> 
> ** using imagemagick
> 
> *** function :noexport:
> #+name: sidebyside
> #+begin_src sh :session none :results file replace :var im1="im1.png" :var 
> im2="im2.png" :var outname="out.png"
>  convert "$im1" "$im2" +append "$outname"
>  echo "$outname"
> #+end_src
> 
> *** test
> #+name: combinedfig
> #+call: sidebyside(im1="img1.pdf", im2="img2.pdf") :results file
> 
> #+caption: stitching side-by-side using imagemagick
> #+results: combinedfig
> [[file:out.png]]
> --8<---cut here---end--->8---
> 
> Regards,
> Andreas



[O] position figures side by side in PDF output

2015-05-20 Thread Zhihao Ding
Hi there, 

Could anyone give me some advice on how to position figures side by side in PDF 
output?
I am trying to write a report, while my figures were all originally produced 
individually.  I’d like 
to put them, mostly two, sometimes three, side by side sharing a same caption 
and label. 
Below is the syntax I am using now, which can only do one figure. 

 #+BEGIN_CENTER
 #+CAPTION[My short Caption]: my long caption
 #+NAME: fig:label
 #+ATTR_LATEX: :options page=1 :width \textwidth
[[/path/to/my/figure1]]
 #+END_CENTER

Thanks a lot!

Zhihao



Re: [O] navigate between source code blocks

2015-05-01 Thread Zhihao Ding
Thank guys. Wolf is new to me and I am trying it now, it already feels 
very attractive! This increases my navigation efficiency quite a bit!  

Zhihao


> On 30 Apr 2015, at 18:25, Oleh Krehel  wrote:
> 
> Leo Ufimtsev  writes:
> 
>> Worf I think is a bit on the vi side of things. Helm is more generic.
> 
> Worf is as much on the vi side of things, as `org-use-speed-commands'
> are. Almost not at all. It just takes vi-style "hjkl" arrows, because
> Emacs-style "bnpf" arrows aren't convenient.
> 
> And it's got the best Helm implementation for navigating to
> headings. I've just added named blocks to this list as well.
> Screenshot: http://oremacs.com/download/worf-goto.png.
> The command to call is "M-x" `worf-goto' or "g" while in `worf-mode'.
> 
> Oleh




Re: [O] navigate between source code blocks

2015-04-29 Thread Zhihao Ding
Thanks very much Oleh. 

Best,
Zhihao


> On 28 Apr 2015, at 08:22, Oleh Krehel  wrote:
> 
> Hi Zhihao,
> 
>> I’ve got a simple question: how to speed up jumping
>> between code blocks?
> 
> You might be interested in https://github.com/abo-abo/worf.
> It allows you to traverse anything that starts with "*" or "#+" with
> just "hjkl" keys.
> See the docs here: http://oremacs.com/worf/README.html.
> 
> regards,
> Oleh



[O] navigate between source code blocks

2015-04-27 Thread Zhihao Ding
Dear Org experts, 

I’ve got a simple question: how to speed up jumping 
between code blocks? 

My org file grows larger every day with more and more
source code blocks. I find myself spending increasing 
amount of time finding the right code blocks to go to. 

Could anyone suggest a method to increase efficiency?
So far I’ve tried (1)  simple search and (2) C-c C-v g, 
which for some reason often fails to find blocks. 

Thanks very much!

Zhihao



Re: [O] latex options

2015-03-30 Thread Zhihao Ding
Thanks Andreas! This is very helpful. 

I am using tags to control how verbose I want my export to be 
and currently they differ slightly between projects. Quite often 
I also have project specific tags. But no problem I think that’s 
manageable with the layout you suggested. 

Best, 
Zhihao


> On 30 Mar 2015, at 11:32, Andreas Leha  
> wrote:
> 
> Hi Zhihao,
> 
> Zhihao Ding  writes:
>> Dear Org experts, 
>> 
>> I was wondering if anyone could advise on this simple problem.
>> My toy org file, shown as below, contains 3 projects. I’d like to  
>> export beamer PDFs for individual projects from time to time, 
>> but the pain is that I always need to modify the header options  
>> (title, select_tags etc) to match the project that I want to export. 
>> 
>> The question is what the best way is to organise the options for 
>> multiple projects? Ideally I’d like to put a copy of the options 
>> under each project, so that I only need to define them once. 
>> It’d be even better if I could specify the file that I want the project
>> to be exported to instead of the same pdf file matching my org
>> file.
>> 
>> #+TITLE: mytitle
>> #+AUTHOR: myself
>> 
>> #+DATE: \today
>> #+LaTeX_CLASS: mybeamer
>> 
>> #+SELECT_TAGS: export
>> #+EXCLUDE_TAGS: noexport
>> 
>> #+OPTIONS: H:4 toc:nil *:
>> 
>> ** project 1
>> ** project 2
>> ** project 3
>> 
> 
> You can add most of these keywords to the properties of a subtree by
> prepending them with 'export_'.  I am not sure about the select tags,
> though.  Why do you need them to differ between the projects?
> 
> 
> Your Example:
> 
> 
> --8<---cut here---start->8---
> #+TITLE: mytitle
> #+AUTHOR: myself
> 
> #+DATE: \today
> #+LaTeX_CLASS: mybeamer
> 
> #+SELECT_TAGS: export
> #+EXCLUDE_TAGS: noexport
> 
> #+OPTIONS: H:4 toc:nil *:
> 
> ** project 1
> :PROPERTIES:
> :header-args:R: :session *mysession1*
> :header-args: :cache yes
> :EXPORT_TITLE: mytitle 1
> :EXPORT_LaTeX_HEADER: \subtitle{mysubtitle 1}
> :EXPORT_FILE_NAME: myfile1
> :EXPORT_DATE: mydate 1
> :EXPORT_LaTeX_CLASS: mybeamer 1
> :EXPORT_OPTIONS: H:2 toc:nil
> :END:
> ** project 2
> :PROPERTIES:
> :header-args:R: :session *mysession2*
> :header-args: :cache yes
> :EXPORT_TITLE: mytitle 2
> :EXPORT_LaTeX_HEADER: \subtitle{mysubtitle 2}
> :EXPORT_FILE_NAME: myfile2
> :EXPORT_DATE: mydate 2
> :EXPORT_LaTeX_CLASS: mybeamer 2
> :EXPORT_OPTIONS: H:2 toc:nil
> :END:
> ** project 3
> :PROPERTIES:
> :header-args:R: :session *mysession3*
> :header-args: :cache yes
> :EXPORT_TITLE: mytitle 3
> :EXPORT_LaTeX_HEADER: \subtitle{mysubtitle 3}
> :EXPORT_FILE_NAME: myfile3
> :EXPORT_DATE: mydate 3
> :EXPORT_LaTeX_CLASS: mybeamer 3
> :EXPORT_OPTIONS: H:2 toc:nil
> :END:
> --8<---cut here---end--->8---
> 
> 
> HTH,
> Andreas



[O] latex options

2015-03-30 Thread Zhihao Ding
Dear Org experts, 

I was wondering if anyone could advise on this simple problem.
My toy org file, shown as below, contains 3 projects. I’d like to  
export beamer PDFs for individual projects from time to time, 
but the pain is that I always need to modify the header options  
(title, select_tags etc) to match the project that I want to export. 

The question is what the best way is to organise the options for 
multiple projects? Ideally I’d like to put a copy of the options 
under each project, so that I only need to define them once. 
It’d be even better if I could specify the file that I want the project
to be exported to instead of the same pdf file matching my org
file.

#+TITLE: mytitle
#+AUTHOR: myself
#+DATE: \today
#+LaTeX_CLASS: mybeamer
#+SELECT_TAGS: export
#+EXCLUDE_TAGS: noexport
#+OPTIONS: H:4 toc:nil *:

** project 1
** project 2
** project 3

Thanks a lot!

Zhihao



Re: [O] shrink latex table to fit beamer slide

2014-12-06 Thread Zhihao Ding
Thanks guys, in the end using R to round numbers and latex 
resizebox to shrink table fonts as Andreas suggested works 
best for me. 

Cheers,
Zhihao


 #+name: origtable
  | 124.195548 |310.528 |   
 | 120.848541 | 122.70234 | 
   
 #+name: formatorigtable
 #+begin_src R :var origtable=origtable :colnames yes
 origtable[,1:2] <- format(origtable[,1:2], digits=3)
 origtable
 #+end_src

 #+results: formatorigtable

 #+LaTeX: \resizebox{\textwidth}{!}{  
 | 124.195 |310.528 |   
 | 120.848 | 122.702 | 
 #+LaTeX: }




> On 6 Dec 2014, at 11:04, Eric S Fraga  wrote:
> 
> On Friday,  5 Dec 2014 at 14:39, Zhihao Ding wrote:
>> Thanks a lot Andreas. Is there a way to globally 
>> shrink/resize table for latex export without having 
> 
> Beamer allows for shrinking of a whole frame to ensure it fits:
> 
> --8<---cut here---start->8---
> * Frame title
> :PROPERTIES:
> :BEAMER_optimisation: shrink
> :END:
> 
> | my | table  |
> | et | cetera |
> --8<---cut here---end--->8---
> 
> The shrink option can also specify a percentage, as in "shrink=20".
> 
> -- 
> : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-581-g0e52f0




Re: [O] shrink latex table to fit beamer slide

2014-12-05 Thread Zhihao Ding
Thanks a lot Andreas. Is there a way to globally 
shrink/resize table for latex export without having 
to define column width like this 
“:align p{1cm} p{0.5cm} p{1cm}” ?
I am hopting to do something like width=\textwidth
and leave the rest to org for finding suitable font 
sizes. 

Zhihao


> On 5 Dec 2014, at 13:12, Andreas Leha  
> wrote:
> 
> Hi Zhihao,
> 
> 
> 
> Zhihao Ding  writes:
>> Dear Org experts, 
>> 
>> I am trying to fit a slightly wide latex table into a beamer 
>> slide in org. Below is my current solution and I was wondering 
>> if anyone can offer some advice on improving it. 
>> 
>> #+begin_scriptsize
>> #+ATTR_LATEX: :align p{1cm} p{0.5cm} p{1cm}
>> |   | | <7> |
>> |  Site | Ind | -log10.pval |
>> | 123279713 |   1 | 6.006102 |
>> | 123279713 |   2 | 6.274326 |
>> | 123279713 |   4 | 6.210920 |
>> | 123279710 |   4 | 97.163695 |
>> | 123279710 |   5 | 208.841892 |
>> #+end_scriptsize
>> 
>> In this solution, the issues are: (1)  for column width 
>> doesn’t seem to round text for latex output, and (2) I need
>> to define column width in addition to . 
>> I’d like to seek a solution that just shrinks the table to fit 
>> the text width without this fiddling. 
>> 
>> Many thanks, 
>> Zhihao
>> 
> 
> first:
> you can set the font size in the #+ATTR_LATEX: line with 
> #+ATTR_LATEX: :font \scriptsize
> 
> second:
> If you want to get the numbers rounded, you can either
> (a) use babel or
> (b) use the spreadsheet capabilities.
> In both cases, you'll generate a new table which you want to export
> 
> example:
> 
> --8<---cut here---start->8---
> * orig table :noexport:
> #+name: origtable
> |   | | <7> |
> |  Site | Ind | -log10.pval |
> | 123279713 |   1 | 6.006102 |
> | 123279713 |   2 | 6.274326 |
> | 123279713 |   4 | 6.210920 |
> | 123279710 |   4 | 97.163695 |
> | 123279710 |   5 | 208.841892 |
> 
> 
> * the table formatted with babel
> This (untested!) used to work, but due to a bug [fn:1] does not.
> 
> #+name: formatorigtable
> #+begin_src R :var origtable=origtable :colnames yes
>  origtable[,3] <- format(origtable[,3], digits=3)
> 
>  origtable
> #+end_src
> 
> #+ATTR_LATEX: :align p{1cm} p{0.5cm} p{1cm}
> #+results: formatorigtable
> 
> 
> * the table formatted with calc/orgmode
> This is quite complicated but works.
> 
> |   | | <7> |
> |  Site | Ind | -log10.pval |
> |---+-+-|
> | 123279713 |   1 |6.01 |
> | 123279713 |   2 |6.27 |
> | 123279713 |   4 |6.21 |
> | 123279710 |   4 |   97.16 |
> | 123279710 |   5 |  208.84 |
> #+TBLFM: $1=remote(origtable, @@#$1)::$2=remote(origtable, 
> @@#$2)::$3=remote(origtable, @@#$3); f-2
> 
> * Footnotes
> 
> [fn:1] I am unable to locate the thread about this for some strange reason.
> The messages were sent between 2014-10-14 and 2014-10-16.
> --8<---cut here---end--->8---
> 
> Best,
> Andreas
> 
> 



[O] shrink latex table to fit beamer slide

2014-12-05 Thread Zhihao Ding
Dear Org experts, 

I am trying to fit a slightly wide latex table into a beamer 
slide in org. Below is my current solution and I was wondering 
if anyone can offer some advice on improving it. 

 #+begin_scriptsize
 #+ATTR_LATEX: :align p{1cm} p{0.5cm} p{1cm}
 |   | | <7> |
 |  Site | Ind | -log10.pval |
 | 123279713 |   1 | 6.006102 |
 | 123279713 |   2 | 6.274326 |
 | 123279713 |   4 | 6.210920 |
 | 123279710 |   4 | 97.163695 |
 | 123279710 |   5 | 208.841892 |
 #+end_scriptsize

In this solution, the issues are: (1)  for column width 
doesn’t seem to round text for latex output, and (2) I need
to define column width in addition to . 
I’d like to seek a solution that just shrinks the table to fit 
the text width without this fiddling. 

Many thanks, 
Zhihao
 

[O] include a specific PDF page to org beamer

2014-11-22 Thread Zhihao Ding
Hi there, 

I was wondering if there is a way to import a specific PDF page
in org beamer?

I tried the following ways but neither 1 or 2 worked and I had to 
retreat to 3, which is a pain as it requires those extra lines for 
each link.

1. 
[[file:~/path/to/myfigure.pdf::10]]

2.
#+ATTR_LATEX: page=10
[[file:~/path/to/myfigure.pdf]]

3.  
#+begin_LaTeX
 \includegraphics[page=10]{file:~/path/to/myfigure.pdf}
#+end_LaTeX

Many thanks!

Zhihao