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 +, 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 Suvayu Ali


On Tue, Jun 02, 2015 at 08:43:07AM +, 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.



Re: [O] resize table in latex

2015-06-01 Thread Suvayu Ali
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.



Re: [O] resize table in latex

2015-06-01 Thread Loris Bennett
Zhihao Ding  writes:

> 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

I'm not sure whether it is related, but I have had problems with using a
colon in names of objects.  Using, say, 'table;label' instead of
'table:label' might help.

Cheers,

Loris

-- 
This signature is currently under construction.




[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