Discussion:
[O] Passing font size to exported LaTeX table
John Hendy
2011-05-24 15:54:00 UTC
Permalink
Hi,


I can control a table font size directly from the .tex file like so:

---
\scriptsize{
\begin{center}
\begin{tabular}{lllrr}

table entries here

\end{tabular}
\end{center}
}
---

Any way to pass this from org-mode? Otherwise, I keep changing the org file,
exporting, and then having to add this to the tex file and re-export.

I tried:
---
#+begin_latex
\scriptsize{
#+end_latex

|org|table|here|

#+begin_latex
}
#+end_latex
---

without success.


Thanks,
John
Sebastien Vauban
2011-05-24 16:44:19 UTC
Permalink
Hi John,
Post by John Hendy
---
\scriptsize{
\begin{center}
\begin{tabular}{lllrr}
table entries here
\end{tabular}
\end{center}
}
---
Any way to pass this from org-mode? Otherwise, I keep changing the org file,
exporting, and then having to add this to the tex file and re-export.
---
#+begin_latex
\scriptsize{
#+end_latex
|org|table|here|
#+begin_latex
}
#+end_latex
---
without success.
You put the things in the wrong order:

1. put a group around some LaTeX commands
2. add the macro \scriptsize in it

Hence:

#+begin_src org
#+begin_latex
{\scriptsize
#+end_latex

|org|table|here|

#+begin_latex
}
#+end_latex
#+end_src

should do it (not tested).

Best regards,
Seb
--
Sébastien Vauban
John Hendy
2011-05-24 18:57:45 UTC
Permalink
On Tue, May 24, 2011 at 11:44 AM, Sebastien Vauban <
Post by Sebastien Vauban
Hi John,
Post by John Hendy
---
\scriptsize{
\begin{center}
\begin{tabular}{lllrr}
table entries here
\end{tabular}
\end{center}
}
---
Any way to pass this from org-mode? Otherwise, I keep changing the org
file,
Post by John Hendy
exporting, and then having to add this to the tex file and re-export.
---
#+begin_latex
\scriptsize{
#+end_latex
|org|table|here|
#+begin_latex
}
#+end_latex
---
without success.
1. put a group around some LaTeX commands
2. add the macro \scriptsize in it
#+begin_src org
#+begin_latex
{\scriptsize
#+end_latex
|org|table|here|
#+begin_latex
}
#+end_latex
#+end_src
should do it (not tested).
I'm getting this error upon export (no PDF created):
---
! Argument of \frame has an extra }.
<inserted text>
\par
l.142 }

Runaway argument?
\par \par \par
! Paragraph ended before \frame was complete.
<to be read again>
\par
l.142 }

! Extra }, or forgotten \endgroup.
<recently read> }

l.142 }

! Extra }, or forgotten \endgroup.
\endframe ->\egroup
\begingroup \def \@currenvir {frame}
l.145 \end{frame}

)
Runaway argument?
---

I'm assuming something is not liking that dangling "}"...

Thoughts?


John
Post by Sebastien Vauban
Best regards,
Seb
--
Sébastien Vauban
Nick Dokos
2011-05-24 19:25:14 UTC
Permalink
Post by Sebastien Vauban
Hi John,
Post by John Hendy
---
\scriptsize{
\begin{center}
\begin{tabular}{lllrr}
table entries here
\end{tabular}
\end{center}
}
---
Any way to pass this from org-mode? Otherwise, I keep changing the org file,
exporting, and then having to add this to the tex file and re-export.
---
#+begin_latex
\scriptsize{
#+end_latex
|org|table|here|
#+begin_latex
}
#+end_latex
---
without success.
1. put a group around some LaTeX commands
2. add the macro \scriptsize in it
#+begin_src org
 #+begin_latex
 {\scriptsize
 #+end_latex
 |org|table|here|
 #+begin_latex
 }
 #+end_latex
#+end_src
should do it (not tested).
---
! Argument of \frame has an extra }.
<inserted text> 
                \par 
l.142 }
       
Runaway argument?
 \par \par \par 
! Paragraph ended before \frame was complete.
<to be read again> 
                   \par 
l.142 }
       
! Extra }, or forgotten \endgroup.
<recently read> }
                 
l.142 }
       
! Extra }, or forgotten \endgroup.
\endframe ->\egroup 
l.145 \end{frame}
                 
)
Runaway argument?
---
I'm assuming something is not liking that dangling "}"...
Thoughts?
I didn't try Seb's workaround but your original solution almost works:
what stops it is YAB in the latex exporter, but having been bitten by
such a couple of times in the past, I applied my usual[fn:1] workaround
and presto! it works:

,----
|
| * foo
|
| #+begin_latex
| \scriptsize{ %}
| #+end_latex
|
| #+tblname: foo
| | table | here |
| |-------+------|
| | table | here |
|
| #+begin_latex
| }
| #+end_latex
`----

The opening brace on the \scriptsize line confuses the exporter and it
leaves the table alone. Adding a commented-out closing brace unconfuses
it.

Nick

Footnotes:

[fn:1] Maybe I should add it to the FAQ?
John Hendy
2011-05-24 19:31:43 UTC
Permalink
Post by John Hendy
Post by John Hendy
On Tue, May 24, 2011 at 11:44 AM, Sebastien Vauban <
Hi John,
Post by John Hendy
I can control a table font size directly from the .tex file like
---
\scriptsize{
\begin{center}
\begin{tabular}{lllrr}
table entries here
\end{tabular}
\end{center}
}
---
Any way to pass this from org-mode? Otherwise, I keep changing the
org file,
Post by John Hendy
Post by John Hendy
exporting, and then having to add this to the tex file and
re-export.
Post by John Hendy
Post by John Hendy
---
#+begin_latex
\scriptsize{
#+end_latex
|org|table|here|
#+begin_latex
}
#+end_latex
---
without success.
1. put a group around some LaTeX commands
2. add the macro \scriptsize in it
#+begin_src org
#+begin_latex
{\scriptsize
#+end_latex
|org|table|here|
#+begin_latex
}
#+end_latex
#+end_src
should do it (not tested).
---
! Argument of \frame has an extra }.
<inserted text>
\par
l.142 }
Runaway argument?
\par \par \par
! Paragraph ended before \frame was complete.
<to be read again>
\par
l.142 }
! Extra }, or forgotten \endgroup.
<recently read> }
l.142 }
! Extra }, or forgotten \endgroup.
\endframe ->\egroup
l.145 \end{frame}
)
Runaway argument?
---
I'm assuming something is not liking that dangling "}"...
Thoughts?
what stops it is YAB in the latex exporter, but having been bitten by
such a couple of times in the past, I applied my usual[fn:1] workaround
,----
|
| * foo
|
| #+begin_latex
| \scriptsize{ %}
| #+end_latex
|
| #+tblname: foo
| | table | here |
| |-------+------|
| | table | here |
|
| #+begin_latex
| }
| #+end_latex
`----
Awesome!! And now I recall seeing it before on the list. Very cool.
Post by John Hendy
The opening brace on the \scriptsize line confuses the exporter and it
leaves the table alone. Adding a commented-out closing brace unconfuses
it.
Nick
[fn:1] Maybe I should add it to the FAQ?
Perhaps -- the tough things is that an issue with braces is not what I would
have expected the problem was. I thought I just wasn't combining things
right or that the org exporter was making something like this impossible
based on how it parsed the text. In any case, yes, it would be cool to have
in public written somewhere. Thanks!
Thomas S. Dye
2011-05-24 19:58:23 UTC
Permalink
Post by John Hendy
Post by John Hendy
Post by John Hendy
On Tue, May 24, 2011 at 11:44 AM, Sebastien Vauban <
Hi John,
Post by John Hendy
I can control a table font size directly from the .tex file like
---
\scriptsize{
\begin{center}
\begin{tabular}{lllrr}
table entries here
\end{tabular}
\end{center}
}
---
Any way to pass this from org-mode? Otherwise, I keep changing the
org file,
Post by John Hendy
Post by John Hendy
exporting, and then having to add this to the tex file and
re-export.
Post by John Hendy
Post by John Hendy
---
#+begin_latex
\scriptsize{
#+end_latex
|org|table|here|
#+begin_latex
}
#+end_latex
---
without success.
1. put a group around some LaTeX commands
2. add the macro \scriptsize in it
#+begin_src org
#+begin_latex
{\scriptsize
#+end_latex
|org|table|here|
#+begin_latex
}
#+end_latex
#+end_src
should do it (not tested).
---
! Argument of \frame has an extra }.
<inserted text>
\par
l.142 }
Runaway argument?
\par \par \par
! Paragraph ended before \frame was complete.
<to be read again>
\par
l.142 }
! Extra }, or forgotten \endgroup.
<recently read> }
l.142 }
! Extra }, or forgotten \endgroup.
\endframe ->\egroup
l.145 \end{frame}
)
Runaway argument?
---
I'm assuming something is not liking that dangling "}"...
Thoughts?
what stops it is YAB in the latex exporter, but having been bitten by
such a couple of times in the past, I applied my usual[fn:1] workaround
,----
|
| * foo
|
| #+begin_latex
| \scriptsize{ %}
| #+end_latex
|
| #+tblname: foo
| | table | here |
| |-------+------|
| | table | here |
|
| #+begin_latex
| }
| #+end_latex
`----
Awesome!! And now I recall seeing it before on the list. Very cool.
Post by John Hendy
The opening brace on the \scriptsize line confuses the exporter and it
leaves the table alone. Adding a commented-out closing brace unconfuses
it.
Nick
[fn:1] Maybe I should add it to the FAQ?
Perhaps -- the tough things is that an issue with braces is not what I would
have expected the problem was. I thought I just wasn't combining things
right or that the org exporter was making something like this impossible
based on how it parsed the text. In any case, yes, it would be cool to have
in public written somewhere. Thanks!
Post by John Hendy
    Hi John,
    >
    > ---
    > \scriptsize{
    > \begin{center}
    > \begin{tabular}{lllrr}
    >
    > table entries here
    >
    > \end{tabular}
    > \end{center}
    > }
    > ---
    >
    > Any way to pass this from org-mode? Otherwise, I keep changing the org file,
    > exporting, and then having to add this to the tex file and re-export.
    >
    > ---
    > #+begin_latex
    > \scriptsize{
    > #+end_latex
    >
    > |org|table|here|
    >
    > #+begin_latex
    > }
    > #+end_latex
    > ---
    >
    > without success.
    1. put a group around some LaTeX commands
    2. add the macro \scriptsize in it
    #+begin_src org
     #+begin_latex
     {\scriptsize
     #+end_latex
     |org|table|here|
     #+begin_latex
     }
     #+end_latex
    #+end_src
    should do it (not tested).
---
! Argument of \frame has an extra }.
<inserted text> 
                \par 
l.142 }
       
Runaway argument?
 \par \par \par 
! Paragraph ended before \frame was complete.
<to be read again> 
                   \par 
l.142 }
       
! Extra }, or forgotten \endgroup.
<recently read> }
                 
l.142 }
       
! Extra }, or forgotten \endgroup.
\endframe ->\egroup 
l.145 \end{frame}
                 
)
Runaway argument?
---
I&#39;m assuming something is not liking that dangling "}"...
Thoughts?
what stops it is YAB in the latex exporter, but having been bitten by
such a couple of times in the past, I applied my usual[fn:1] workaround
,----
|
| * foo
|
| #+begin_latex
| \scriptsize{ %}
| #+end_latex
|
| #+tblname: foo
| | table | here |
| |-------+------|
| | table | here |
|
| #+begin_latex
| }
| #+end_latex
`----
Awesome!! And now I recall seeing it before on the list. Very cool. 
The opening brace on the \scriptsize line confuses the exporter and it
leaves the table alone. Adding a commented-out closing brace unconfuses
it.
Nick
[fn:1] Maybe I should add it to the FAQ?Perhaps -- the tough things is that an issue with braces is not what I would have expected the problem was. I thought I just wasn&#39;t combining things right or that the org exporter was making something like this impossible based on how it parsed the text. In any case, yes, it would be cool to have in public written somewhere. Thanks! 
Aloha all,

This appears to work for tabular environments only. When I add a
caption the table is set normalsize and the text following it is set
scriptsize. Or, am I doing something wrong?

All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
Nick Dokos
2011-05-24 20:42:52 UTC
Permalink
Post by Thomas S. Dye
This appears to work for tabular environments only. When I add a
caption the table is set normalsize and the text following it is set
scriptsize. Or, am I doing something wrong?
Oy, vey: I don't think you are doing anything wrong - I get the same
thing.

Can \scriptsize be used as a macro with argument? I don't have
my references here. If I do it the way Seb suggested, inside an
environment, it seems to work better, in the sense that it does not
change the thing after the table - but the table is unaffected
nevertheless. I guess the table environment sets a font size explicitly,
overriding outside settings.

Nick
Nick Dokos
2011-05-24 21:12:46 UTC
Permalink
Post by Nick Dokos
Post by Thomas S. Dye
This appears to work for tabular environments only. When I add a
caption the table is set normalsize and the text following it is set
scriptsize. Or, am I doing something wrong?
Oy, vey: I don't think you are doing anything wrong - I get the same
thing.
Can \scriptsize be used as a macro with argument? I don't have
my references here. If I do it the way Seb suggested, inside an
environment, it seems to work better, in the sense that it does not
change the thing after the table - but the table is unaffected
nevertheless. I guess the table environment sets a font size explicitly,
overriding outside settings.
table -> float -> xfloat -> floatboxreset -> normalsize

So you can redefine floatboreset to change the size:

scripttab.sty:
--8<---------------cut here---------------start------------->8---
\makeatletter
\def \@floatboxreset {%
\***@font
\scriptsize
\@setminipage
}
\makeatother
--8<---------------cut here---------------end--------------->8---

scripttab.org:
Nick Dokos
2011-05-24 21:19:09 UTC
Permalink
[Fat-fingered it and sent it prematurely - sorry about that]
Post by Nick Dokos
Post by Nick Dokos
Post by Thomas S. Dye
This appears to work for tabular environments only. When I add a
caption the table is set normalsize and the text following it is set
scriptsize. Or, am I doing something wrong?
Oy, vey: I don't think you are doing anything wrong - I get the same
thing.
Can \scriptsize be used as a macro with argument? I don't have
my references here. If I do it the way Seb suggested, inside an
environment, it seems to work better, in the sense that it does not
change the thing after the table - but the table is unaffected
nevertheless. I guess the table environment sets a font size explicitly,
overriding outside settings.
table -> float -> xfloat -> floatboxreset -> normalsize
This was supposed to say that yes, indeed, the table environment sets
\normalsize explicitly, through this sequence of macro calls.
floatboxreset
Post by Nick Dokos
\makeatletter
\scriptsize
}
\makeatother
scripttab.sty:
--8<---------------cut here---------------start------------->8---
\makeatletter
\def \@floatboxreset {%
\***@font
\scriptsize
\@setminipage
}
\makeatother
--8<---------------cut here---------------end--------------->8---

scripttab.org:
--8<---------------cut here---------------start------------->8---
#+LaTeX_HEADER: \usepackage{scripttab}

* foo

What's this?


#+tblname: foo
#+CAPTION: foo
| table | here |
|-------+------|
| table | here |

What's this?

--8<---------------cut here---------------end--------------->8---

I think this works OK.

Nick
Thomas S. Dye
2011-05-25 07:22:19 UTC
Permalink
Post by Nick Dokos
[Fat-fingered it and sent it prematurely - sorry about that]
Post by Nick Dokos
Post by Nick Dokos
Post by Thomas S. Dye
This appears to work for tabular environments only. When I add a
caption the table is set normalsize and the text following it is set
scriptsize. Or, am I doing something wrong?
Oy, vey: I don't think you are doing anything wrong - I get the same
thing.
Can \scriptsize be used as a macro with argument? I don't have
my references here. If I do it the way Seb suggested, inside an
environment, it seems to work better, in the sense that it does not
change the thing after the table - but the table is unaffected
nevertheless. I guess the table environment sets a font size explicitly,
overriding outside settings.
table -> float -> xfloat -> floatboxreset -> normalsize
This was supposed to say that yes, indeed, the table environment sets
\normalsize explicitly, through this sequence of macro calls.
floatboxreset
Post by Nick Dokos
\makeatletter
\scriptsize
}
\makeatother
\makeatletter
\scriptsize
}
\makeatother
#+LaTeX_HEADER: \usepackage{scripttab}
* foo
What's this?
#+tblname: foo
#+CAPTION: foo
| table | here |
|-------+------|
| table | here |
What's this?
I think this works OK.
Nick
Aloha Nick,

This works like a charm. Thanks!

All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
suvayu ali
2011-05-27 00:58:36 UTC
Permalink
Hello,
Post by Thomas S. Dye
Post by Nick Dokos
#+LaTeX_HEADER: \usepackage{scripttab}
* foo
What's this?
#+tblname: foo
#+CAPTION: foo
| table | here |
|-------+------|
| table | here |
What's this?
I think this works OK.
Nick
Aloha Nick,
This works like a charm.  Thanks!
Although this is solved now, I found a very simple solution.

e.g. for footnotesize just add the line:

#+ATTR_LaTeX: placement=[<options>]\footnotesize
--
Suvayu

Open source is the future. It sets us free.
Thomas S. Dye
2011-05-27 06:46:56 UTC
Permalink
Post by suvayu ali
Hello,
Post by Thomas S. Dye
Post by Nick Dokos
#+LaTeX_HEADER: \usepackage{scripttab}
* foo
What's this?
#+tblname: foo
#+CAPTION: foo
| table | here |
|-------+------|
| table | here |
What's this?
I think this works OK.
Nick
Aloha Nick,
This works like a charm.  Thanks!
Although this is solved now, I found a very simple solution.
#+ATTR_LaTeX: placement=[<options>]\footnotesize
Aloha Suvayu,

And this works, too. Thanks!

Can I ask where you found this simple solution?

All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
suvayu ali
2011-05-27 07:07:45 UTC
Permalink
Hi Tom,
Post by Thomas S. Dye
Post by suvayu ali
Although this is solved now, I found a very simple solution.
#+ATTR_LaTeX: placement=[<options>]\footnotesize
Aloha Suvayu,
And this works, too.  Thanks!
Can I ask where you found this simple solution?
Of course you may. :) I came across a few very nicely written articles
by LF Mori in The Practex Journal. This particular solution was
discussed in section 3.1 of the following article:

<http://www.tug.org/pracjourn/2007-1/mori/>

HTH
--
Suvayu

Open source is the future. It sets us free.
Thomas S. Dye
2011-05-27 16:17:04 UTC
Permalink
Post by suvayu ali
Hi Tom,
Post by Thomas S. Dye
Post by suvayu ali
Although this is solved now, I found a very simple solution.
#+ATTR_LaTeX: placement=[<options>]\footnotesize
Aloha Suvayu,
And this works, too.  Thanks!
Can I ask where you found this simple solution?
Of course you may. :) I came across a few very nicely written articles
by LF Mori in The Practex Journal. This particular solution was
<http://www.tug.org/pracjourn/2007-1/mori/>
HTH
Aloha Suvayu,

Thank you for the link to the Mori article. It is nicely written.

My question was poorly written, though. I'm interested to know where
you found the Org-mode line:

#+ATTR_LaTeX: placement=[<options>]\footnotesize

I haven't been able to find this solution anywhere else.

All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
Suvayu Ali
2011-05-27 16:50:13 UTC
Permalink
Hello Tom,

On Fri, 27 May 2011 06:17:04 -1000
Post by Thomas S. Dye
Aloha Suvayu,
Thank you for the link to the Mori article. It is nicely written.
My question was poorly written, though. I'm interested to know where
#+ATTR_LaTeX: placement=[<options>]\footnotesize
I haven't been able to find this solution anywhere else.
I got the solution by reading between the lines and some
experimentation. The placement option is documented in the section
referenced below[1]. Note that this does not say anything about tables.
I think I found it by experimenting that this also works for tables.
When I saw the LaTeX solution in the article I mentioned earlier, I
tried out and found exporting as above works. :)
Post by Thomas S. Dye
All the best,
Tom
HTH

Footnotes:

[1] <http://orgmode.org/manual/Images-in-LaTeX-export.html#Images-in-LaTeX-export>
--
Suvayu

Open source is the future. It sets us free.
Thomas S. Dye
2011-05-27 17:37:50 UTC
Permalink
Post by Suvayu Ali
Hello Tom,
On Fri, 27 May 2011 06:17:04 -1000
Post by Thomas S. Dye
Aloha Suvayu,
Thank you for the link to the Mori article. It is nicely written.
My question was poorly written, though. I'm interested to know where
#+ATTR_LaTeX: placement=[<options>]\footnotesize
I haven't been able to find this solution anywhere else.
I got the solution by reading between the lines and some
experimentation. The placement option is documented in the section
referenced below[1]. Note that this does not say anything about tables.
I think I found it by experimenting that this also works for tables.
When I saw the LaTeX solution in the article I mentioned earlier, I
tried out and found exporting as above works. :)
Post by Thomas S. Dye
All the best,
Tom
HTH
[1] <http://orgmode.org/manual/Images-in-LaTeX-export.html#Images-in-LaTeX-export>
Aloha Suvayu,

I think #+ATTR_LaTeX: needs more documentation. I worked very hard to
read between the lines of the Org-mode manual to arrive at your simple
solution but didn't manage to come close!

Are you able to summarize the possibilities of #+ATTR_LaTeX? I'm
thinking that a general description somewhere in the Org-mode manual
might be useful. It would probably also be good to augment the existing
descriptions of its use in the manual, as well. Perhaps it would be
possible to propose a patch to the documentation?

All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
Suvayu Ali
2011-05-27 18:30:13 UTC
Permalink
Hello Tom,

On Fri, 27 May 2011 07:37:50 -1000
Post by Thomas S. Dye
Aloha Suvayu,
I think #+ATTR_LaTeX: needs more documentation. I worked very hard to
read between the lines of the Org-mode manual to arrive at your simple
solution but didn't manage to come close!
Are you able to summarize the possibilities of #+ATTR_LaTeX? I'm
thinking that a general description somewhere in the Org-mode manual
might be useful. It would probably also be good to augment the
existing descriptions of its use in the manual, as well. Perhaps it
would be possible to propose a patch to the documentation?
I am not very familiar with org-latex internals. Based on my limited
understanding I wrote the attached patch to the org manual. I hope it
is up to par.
Post by Thomas S. Dye
All the best,
Tom
Thanks a lot for your encouragement. :)
--
Suvayu

Open source is the future. It sets us free.
Thomas S. Dye
2011-05-27 21:25:05 UTC
Permalink
Post by Suvayu Ali
Hello Tom,
On Fri, 27 May 2011 07:37:50 -1000
Post by Thomas S. Dye
Aloha Suvayu,
I think #+ATTR_LaTeX: needs more documentation. I worked very hard to
read between the lines of the Org-mode manual to arrive at your simple
solution but didn't manage to come close!
Are you able to summarize the possibilities of #+ATTR_LaTeX? I'm
thinking that a general description somewhere in the Org-mode manual
might be useful. It would probably also be good to augment the
existing descriptions of its use in the manual, as well. Perhaps it
would be possible to propose a patch to the documentation?
I am not very familiar with org-latex internals. Based on my limited
understanding I wrote the attached patch to the org manual. I hope it
is up to par.
Post by Thomas S. Dye
All the best,
Tom
Thanks a lot for your encouragement. :)
--
Suvayu
Open source is the future. It sets us free.
Sebastien Vauban
2011-05-28 07:17:18 UTC
Permalink
Hi Thomas and Suvayu,
diff --git a/doc/org.texi b/doc/org.texi
index aa34cd3..5fa1e22 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10160,7 +10160,7 @@ All lines between these markers are exported literally
@subsection Tables in @LaTeX{} export
@cindex tables, in @LaTeX{} export
@@ -10207,7 +10207,20 @@ element. You can use an @code{#+ATTR_LaTeX:} line to specify the various
options that can be used in the optional argument of the
@code{\includegraphics} macro. To modify the placement option of the
@code{figure} environment, add something like @samp{placement=[h!]} to the
-Attributes.
+Attributes. It is to be noted this option can be used with tables as well.
+The options are passed as the placement option to floating environments like
+
+#+ATTR_LaTeX: placement=[<options>]\footnotesize
+
+\begin{figure}[<options>]\footnotesize
+...
+\end{figure}
This looks like an improvement to me.
I think so too. The real test will be, though, the day I will search for
additional info about the tables. And the above text seems neat to me.
I'd be interested to hear what Nick and Seb might have to say. They often
catch things I miss.
;-)
If you don't get other comments, I'd encourage you to submit this as a patch
(I think this requires [PATCH] in the subject line) to see what Carsten and
crew have to say about it.
Thanks again for finding this solution to specifying the font size for
floating tables on a table-by-table basis in LaTeX export. I'd been looking
for your solution, and for Nick's solution that works on a per-document or
buffer basis, for many months without success.
Thanks to both of you, for closing this loop up to the documentation stuff!

Best regards,
Seb
--
Sébastien Vauban
Suvayu Ali
2011-05-28 10:14:24 UTC
Permalink
Hi Tom and Seb,

On Sat, 28 May 2011 09:17:18 +0200
Post by Sebastien Vauban
This looks like an improvement to me.
I think so too. The real test will be, though, the day I will search
for additional info about the tables. And the above text seems neat
to me.
Great! All is in order then. :)
Post by Sebastien Vauban
If you don't get other comments, I'd encourage you to submit this
as a patch (I think this requires [PATCH] in the subject line) to
see what Carsten and crew have to say about it.
From what I understand the patchwork server queues messages based on
the MIME type and contents of the attachment. If that is correct this
should be picked up just fine.
Post by Sebastien Vauban
Thanks again for finding this solution to specifying the font size
for floating tables on a table-by-table basis in LaTeX export. I'd
been looking for your solution, and for Nick's solution that works
on a per-document or buffer basis, for many months without
success.
Thanks to both of you, for closing this loop up to the documentation stuff!
Thanks everyone, :)
--
Suvayu

Open source is the future. It sets us free.
Nick Dokos
2011-05-28 15:21:15 UTC
Permalink
If you don't get other comments, I'd encourage you to submit this
as a patch (I think this requires [PATCH] in the subject line) to
see what Carsten and crew have to say about it.
=46rom what I understand the patchwork server queues messages based on
the MIME type and contents of the attachment. If that is correct this
should be picked up just fine.
I just checked: so far at least, it's not on patchwork.

Nick
Suvayu Ali
2011-05-28 18:10:03 UTC
Permalink
On Sat, 28 May 2011 11:21:15 -0400
Post by Nick Dokos
If you don't get other comments, I'd encourage you to submit
this as a patch (I think this requires [PATCH] in the subject
line) to see what Carsten and crew have to say about it.
=46rom what I understand the patchwork server queues messages based
on the MIME type and contents of the attachment. If that is correct
this should be picked up just fine.
I just checked: so far at least, it's not on patchwork.
Okay, I'll send it again on a separate thread with a proper subject
line.
Post by Nick Dokos
Nick
--
Suvayu

Open source is the future. It sets us free.
Nick Dokos
2011-06-01 18:50:34 UTC
Permalink
Post by Suvayu Ali
I am not very familiar with org-latex internals. Based on my limited
understanding I wrote the attached patch to the org manual. I hope it
is up to par.
[patch snipped]
This looks like an improvement to me. I'd be interested to hear what
Nick and Seb might have to say. They often catch things I miss.
If you don't get other comments, I'd encourage you to submit this as a
patch (I think this requires [PATCH] in the subject line) to see what
Carsten and crew have to say about it.
Thanks again for finding this solution to specifying the font size for
floating tables on a table-by-table basis in LaTeX export. I'd been
looking for your solution, and for Nick's solution that works on a
per-document or buffer basis, for many months without success.
Maybe I can contribute some commentary to the code and ask Suvayu to perhaps
amend the patch to clarify some things (but see my editorial comment at
the end of the email):

<code commentary>
There are two parts to the code: one is in org-exp.el,
org-export-attach-captions-and-attributes(), which matches caption,
label and attr_latex lines and adds text properties for later use by the
export backend. It figures out whether the following item is a table or
a link and it adds the appropriate text property (or properties - one or
more can be present for a given itme) to the item: either the whole
table[fn:1] or the line containing the link. There are three different
properties corresponding to the #+foo construct: 'org-caption,
'org-labeland and 'org-attributes.

The second part is in the specific backend - latex in this case (I did
not look at the others). There are two cases: tables and links.


The table case is handled by org-export-latex tables. It gets the
caption label and attributes from the corresponding text property. It
then further parses the string it gets from the 'org-attributes property
to figure out:

- whether this is a longtable (a table spanning multiple pages)
(syntax: the string "longtable" as a word)
- whether it's a table or a table* (syntax: the string itself)
- whether it's a tabular (syntax: the string "tabular" followed by a
single char - that's to catch the tabular*, tabularx and tabulary
cases I believe).
- what the width is (syntax: "width=XXX" where XXX is a sequence of
anything but white space and there is a word boundary before
"width" - i.e. " width=foo" will set the width to foo but "
linewidth=foo" will not).
- what the alignment is (syntax: same as width but with "align"
instead)
- what the placement is (syntax: "placement=XXX" - where XXX is a
string of one or more non-white-space characters.

Suvayu's method works by taking advantage of the fact that the placement
"value" (i.e. the string to the right of the equal sign) does not
contain white space and copies the whole thing as the placement value in
the correct place in the table environment. LaTeX then parses this and
breaks it up into placement and \scriptsize constructs. Since org adds
the placement info to the table environment, \scriptsize sneaks in by
the back door, so to speak.

In the case of a link (which presumably points to an image and handled by
org-export-latex-links and org-export-latex-format-image), the parsing
of the property figures out

- whether to use wrapfigure (syntax: "wrap" as a word)
- whether to use the figure env (syntax: "float" as a word)
- whether to use the figure* env (syntax: "multicolumn" as a word)
- what the placement is (syntax: same as above)

In addition, whether there is a caption or a label determines whether
the figure is floated or inlined.

</code commentary>

<soapbox> I've tried to keep a neutral tone in (most of) the rest of the
mail, but I have to say that I think clever hacks like this are too
clever for their own good - they are at best an accident of
implementation. The fact that the trick uses the placement option in
order to change the font testifies to that. They should certainly be
documented as hacks on Worg, but I'm not sure they should be documented
in the manual. Of course, it may happen that a really good hack (by some
definition of "really good") should be elevated to a standard and
documented in the manual, but IMO this one does not qualify. </soapbox>

Comments, corrections, additions are more than welcome.

Nick

Footnotes:

[fn:1] BTW, the documentation of the function says that the property is
added to the first line of the table, but unless I misread the code,
that's wrong: it gets added to the whole table.
Suvayu Ali
2011-06-01 19:08:25 UTC
Permalink
Hi Nick,

A very big thank you for that crystal clear code commentary.

On Wed, 01 Jun 2011 14:50:34 -0400
Post by Nick Dokos
<soapbox> I've tried to keep a neutral tone in (most of) the rest of
the mail, but I have to say that I think clever hacks like this are
too clever for their own good - they are at best an accident of
implementation. The fact that the trick uses the placement option in
order to change the font testifies to that.
After the very clear description above, I agree 100%. I will remove my
addition to the manual and instead try to improve the #+ATTR_LaTeX:
documentation based on your code commentary. At the moment I am facing a
very important deadline for the 8th of June, I will submit a revised
patch after that.
Post by Nick Dokos
They should certainly be documented as hacks on Worg, but I'm not sure
they should be documented in the manual. Of course, it may happen that
a really good hack (by some definition of "really good") should be
elevated to a standard and documented in the manual, but IMO this one
does not qualify. </soapbox>
Along with the revisions for the manual, I will document my hack on Worg.
Post by Nick Dokos
Comments, corrections, additions are more than welcome.
Thanks a lot! :)
Post by Nick Dokos
Nick
--
Suvayu

Open source is the future. It sets us free.
Suvayu Ali
2011-06-10 22:31:21 UTC
Permalink
Hello everyone,

On Wed, 1 Jun 2011 12:08:25 -0700
Post by Suvayu Ali
On Wed, 01 Jun 2011 14:50:34 -0400
Post by Nick Dokos
<soapbox> I've tried to keep a neutral tone in (most of) the rest of
the mail, but I have to say that I think clever hacks like this are
too clever for their own good - they are at best an accident of
implementation. The fact that the trick uses the placement option in
order to change the font testifies to that.
After the very clear description above, I agree 100%. I will remove my
documentation based on your code commentary. At the moment I am
facing a very important deadline for the 8th of June, I will submit a
revised patch after that.
I have attached a patch removing the hack from the manual and making
some other small improvements to the latex export of images. However I
did leave in one sentence regarding the placement option which alludes
that a hack is possible.

Please let me know if this is an improvement.
Post by Suvayu Ali
Post by Nick Dokos
They should certainly be documented as hacks on Worg, but I'm not
sure they should be documented in the manual. Of course, it may
happen that a really good hack (by some definition of "really
good") should be elevated to a standard and documented in the
manual, but IMO this one does not qualify. </soapbox>
Along with the revisions for the manual, I will document my hack on Worg.
I made an account with repo.or.cz. I will soon push the changes
documenting the hack on Worg.
--
Suvayu

Open source is the future. It sets us free.
suvayu ali
2011-06-13 01:38:52 UTC
Permalink
Post by Suvayu Ali
Post by Suvayu Ali
Post by Nick Dokos
They should certainly be documented as hacks on Worg, but I'm not
sure they should be documented in the manual. Of course, it may
happen that a really good hack (by some definition of "really
good") should be elevated to a standard and documented in the
manual, but IMO this one does not qualify. </soapbox>
Along with the revisions for the manual, I will document my hack on Worg.
I made an account with repo.or.cz. I will soon push the changes
documenting the hack on Worg.
Here is the documentation on Worg. Comments are welcome.

<http://orgmode.org/worg/org-hacks.html#sec-1_6_1>
--
Suvayu

Open source is the future. It sets us free.
Nick Dokos
2011-06-13 01:52:51 UTC
Permalink
Post by Suvayu Ali
Hello everyone,
On Wed, 1 Jun 2011 12:08:25 -0700
Post by Suvayu Ali
On Wed, 01 Jun 2011 14:50:34 -0400
Post by Nick Dokos
<soapbox> I've tried to keep a neutral tone in (most of) the rest of
the mail, but I have to say that I think clever hacks like this are
too clever for their own good - they are at best an accident of
implementation. The fact that the trick uses the placement option in
order to change the font testifies to that.
After the very clear description above, I agree 100%. I will remove my
documentation based on your code commentary. At the moment I am
facing a very important deadline for the 8th of June, I will submit a
revised patch after that.
I have attached a patch removing the hack from the manual and making
some other small improvements to the latex export of images. However I
did leave in one sentence regarding the placement option which alludes
that a hack is possible.
Please let me know if this is an improvement.
Post by Suvayu Ali
Post by Nick Dokos
They should certainly be documented as hacks on Worg, but I'm not
sure they should be documented in the manual. Of course, it may
happen that a really good hack (by some definition of "really
good") should be elevated to a standard and documented in the
manual, but IMO this one does not qualify. </soapbox>
Along with the revisions for the manual, I will document my hack on Worg.
I made an account with repo.or.cz. I will soon push the changes
documenting the hack on Worg.
--
Suvayu
Open source is the future. It sets us free.
Suvayu Ali
2011-06-13 02:40:53 UTC
Permalink
Hi Nick,

On Sun, 12 Jun 2011 21:52:51 -0400
The question here is: what does "compatible" mean? Compatible with
"One can also take advantage of this option to pass other, unrelated
options into the figure or table environment (see
[[http://orgmode.org/worg/org-hacks.html#sec-1_6_1][here]] for an
example.)"
or something like that.
Thanks for the comment.

I modified the patch as per your suggestion. For the link however,
instead of a direct link to the section I linked to the org hacks page
and named the section, just in case the section ordering changes in
the future for some reason.

Here is my submission:
<http://thread.gmane.org/gmane.emacs.orgmode/42776>

:)
--
Suvayu

Open source is the future. It sets us free.
Nick Dokos
2011-06-13 03:29:46 UTC
Permalink
Post by Suvayu Ali
Hi Nick,
On Sun, 12 Jun 2011 21:52:51 -0400
The question here is: what does "compatible" mean? Compatible with
"One can also take advantage of this option to pass other, unrelated
options into the figure or table environment (see
[[http://orgmode.org/worg/org-hacks.html#sec-1_6_1][here]] for an
example.)"
or something like that.
Thanks for the comment.
I modified the patch as per your suggestion. For the link however,
instead of a direct link to the section I linked to the org hacks page
and named the section, just in case the section ordering changes in
the future for some reason.
<http://thread.gmane.org/gmane.emacs.orgmode/42776>
:)
Looks good to me.

Thanks,
Nick
Thomas S. Dye
2011-06-13 03:45:58 UTC
Permalink
Post by Suvayu Ali
Hello everyone,
On Wed, 1 Jun 2011 12:08:25 -0700
Post by Suvayu Ali
On Wed, 01 Jun 2011 14:50:34 -0400
Post by Nick Dokos
<soapbox> I've tried to keep a neutral tone in (most of) the rest of
the mail, but I have to say that I think clever hacks like this are
too clever for their own good - they are at best an accident of
implementation. The fact that the trick uses the placement option in
order to change the font testifies to that.
After the very clear description above, I agree 100%. I will remove my
documentation based on your code commentary. At the moment I am
facing a very important deadline for the 8th of June, I will submit a
revised patch after that.
I have attached a patch removing the hack from the manual and making
some other small improvements to the latex export of images. However I
did leave in one sentence regarding the placement option which alludes
that a hack is possible.
Please let me know if this is an improvement.
Post by Suvayu Ali
Post by Nick Dokos
They should certainly be documented as hacks on Worg, but I'm not
sure they should be documented in the manual. Of course, it may
happen that a really good hack (by some definition of "really
good") should be elevated to a standard and documented in the
manual, but IMO this one does not qualify. </soapbox>
Along with the revisions for the manual, I will document my hack on Worg.
I made an account with repo.or.cz. I will soon push the changes
documenting the hack on Worg.
--
Suvayu
Open source is the future. It sets us free.
Nick Dokos
2011-06-13 04:27:31 UTC
Permalink
Nick's got a good editorial eye: "compatible options" is probably not
correct. In the example on Worg hacks, \footnotesize is not an optional
argument to the \table environment, it is a LaTeX command whose scope is
determined by the \table environment within which it is issued. So,
instead of "One can also pass other compatible options" it would be good
to say "One can also pass LaTeX commands into the \table environment" or
something along those lines.
The entry in Worg hacks looks good to me. Thanks for taking care of
this, Suvayu.
Many thanks to Nick and Suvayu for figuring out how to get inside the
table environment from Org-mode. I can't remember how many times I
tried and failed to figure this out on my own ...
Now that the Worg entry exists, I'd like to expand it a bit to add
essentially what Tom mentions in his first paragraph and also to add a
pointer to the "other" solution of this problem.

Suvauy, is that OK with you? Or would you rather I created a
separate hack?

Nick
Suvayu Ali
2011-06-13 04:56:59 UTC
Permalink
Hi Nick and Tom,

On Mon, 13 Jun 2011 00:27:31 -0400
Post by Nick Dokos
Nick's got a good editorial eye: "compatible options" is probably
not correct. In the example on Worg hacks, \footnotesize is not an
optional argument to the \table environment, it is a LaTeX command
whose scope is determined by the \table environment within which it
is issued. So, instead of "One can also pass other compatible
options" it would be good to say "One can also pass LaTeX commands
into the \table environment" or something along those lines.
The entry in Worg hacks looks good to me. Thanks for taking care of
this, Suvayu.
Many thanks to Nick and Suvayu for figuring out how to get inside
the table environment from Org-mode. I can't remember how many
times I tried and failed to figure this out on my own ...
Now that the Worg entry exists, I'd like to expand it a bit to add
essentially what Tom mentions in his first paragraph and also to add a
pointer to the "other" solution of this problem.
I have modified the Worg entry like this

*** Specifying LaTeX commands to floating environments

The keyword ~placement~ can be used to specify placement options to
floating environments (like =\begin{figure}= and =\begin{table}=}) in
LaTeX export. Org passes along everything passed in options as long as
there are no spaces. One can take advantage of this to pass other
LaTeX commands limited within the scope of the floating environment.

For example one can set the fontsize of a table different from the
rest of the document by putting something like =\footnotesize= right
after the placement options. During LaTeX export using the
~#+ATTR_LaTeX:~ line below:

#+begin_src org
,#+ATTR_LaTeX: placement=[<options>]\footnotesize
#+end_src

exports the associated floating environment as shown in the following
block.

#+begin_src latex
\begin{table}[<options>]\footnotesize
...
\end{table}
#+end_src

If both of you agree and there is no important detail or subtlety
missing, I will commit this to Worg.
Post by Nick Dokos
Suvauy, is that OK with you? Or would you rather I created a
separate hack?
Worg is a community resource. I would definitely be okay with and
encourage others improving upon whatever I contribute. :)
Post by Nick Dokos
Nick
--
Suvayu

Open source is the future. It sets us free.
Nick Dokos
2011-06-13 05:29:03 UTC
Permalink
Post by Suvayu Ali
Hi Nick and Tom,
On Mon, 13 Jun 2011 00:27:31 -0400
Post by Nick Dokos
Nick's got a good editorial eye: "compatible options" is probably
not correct. In the example on Worg hacks, \footnotesize is not an
optional argument to the \table environment, it is a LaTeX command
whose scope is determined by the \table environment within which it
is issued. So, instead of "One can also pass other compatible
options" it would be good to say "One can also pass LaTeX commands
into the \table environment" or something along those lines.
The entry in Worg hacks looks good to me. Thanks for taking care of
this, Suvayu.
Many thanks to Nick and Suvayu for figuring out how to get inside
the table environment from Org-mode. I can't remember how many
times I tried and failed to figure this out on my own ...
Now that the Worg entry exists, I'd like to expand it a bit to add
essentially what Tom mentions in his first paragraph and also to add a
pointer to the "other" solution of this problem.
I have modified the Worg entry like this
*** Specifying LaTeX commands to floating environments
The keyword ~placement~ can be used to specify placement options to
floating environments (like =\begin{figure}= and =\begin{table}=}) in
LaTeX export. Org passes along everything passed in options as long as
there are no spaces. One can take advantage of this to pass other
LaTeX commands limited within the scope of the floating environment.
I'd rewrite this last line slightly - the scope belongs to the command and
the environment withing which the command is placed, limits the scope of the
command:

"...LaTeX commands and have their scope limited to the floating environment."
Post by Suvayu Ali
For example one can set the fontsize of a table different from the
rest of the document by putting something like =\footnotesize= right
This is not quite right: the fontsize in the table is by default set to
normal size, but the rest of the document does not have to be normal
size. I suggest

"...For example one can set the fontsize of a table different from the
default normal size by putting something like =\footnotesize= right..."
Post by Suvayu Ali
after the placement options. During LaTeX export using the
#+begin_src org
,#+ATTR_LaTeX: placement=[<options>]\footnotesize
#+end_src
exports the associated floating environment as shown in the following
block.
#+begin_src latex
\begin{table}[<options>]\footnotesize
...
\end{table}
#+end_src
If both of you agree and there is no important detail or subtlety
missing, I will commit this to Worg.
Otherwise, looks good.
Post by Suvayu Ali
Post by Nick Dokos
Suvauy, is that OK with you? Or would you rather I created a
separate hack?
Worg is a community resource. I would definitely be okay with and
encourage others improving upon whatever I contribute. :)
But common courtesy dictates that I should at least ask :-) In any case,
I'm planning to post to the ML for review whatever changes I come up
with.

Thanks,
Nick
Suvayu Ali
2011-06-13 06:42:35 UTC
Permalink
Hi Nick,

On Mon, 13 Jun 2011 01:29:03 -0400
Post by Nick Dokos
Post by Suvayu Ali
LaTeX commands limited within the scope of the floating environment.
I'd rewrite this last line slightly - the scope belongs to the
command and the environment withing which the command is placed,
"...LaTeX commands and have their scope limited to the floating environment."
Post by Suvayu Ali
For example one can set the fontsize of a table different from the
rest of the document by putting something like =\footnotesize= right
This is not quite right: the fontsize in the table is by default set
to normal size, but the rest of the document does not have to be
normal size. I suggest
"...For example one can set the fontsize of a table different from the
default normal size by putting something like =\footnotesize=
right..."
Done and pushed. :)
Post by Nick Dokos
Thanks,
Nick
Thanks for the comments,
--
Suvayu

Open source is the future. It sets us free.
Nick Dokos
2011-05-24 20:06:46 UTC
Permalink
Post by Nick Dokos
The opening brace on the \scriptsize line confuses the exporter and it
leaves the table alone. Adding a commented-out closing brace unconfuses
it.
Nick
[fn:1] Maybe I should add it to the FAQ?
Perhaps -- the tough things is that an issue with braces is not what I
would have expected the problem was. I thought I just wasn't combining
things right or that the org exporter was making something like this
impossible based on how it parsed the text. In any case, yes, it would
be cool to have in public written somewhere. Thanks! 
The best debugging technique I can suggest here is to export to LaTeX
and then look at the .tex file. It's usually clear what broke, who is
responsible and, often, how to fix it.

In this case, the org table looked untouched by the exporter, but when I
got rid of the ``\scriptsize {'', the table was properly exported.

Nick
Sebastien Vauban
2011-05-24 19:42:14 UTC
Permalink
Hi John and Nick,
Post by Nick Dokos
Post by Sebastien Vauban
Post by John Hendy
---
\scriptsize{
\begin{center}
\begin{tabular}{lllrr}
table entries here
\end{tabular}
\end{center}
}
---
Any way to pass this from org-mode? Otherwise, I keep changing the org file,
exporting, and then having to add this to the tex file and re-export.
I tried [...]
without success.
1. put a group around some LaTeX commands
2. add the macro \scriptsize in it
#+begin_src org
 #+begin_latex
 {\scriptsize
 #+end_latex
 |org|table|here|
 #+begin_latex
 }
 #+end_latex
#+end_src
should do it (not tested).
---
! Argument of \frame has an extra }.
<inserted text> 
                \par 
l.142 }
       
Runaway argument?
 \par \par \par 
! Paragraph ended before \frame was complete.
<to be read again> 
                   \par 
l.142 }
       
! Extra }, or forgotten \endgroup.
<recently read> }
                 
l.142 }
       
! Extra }, or forgotten \endgroup.
\endframe ->\egroup 
l.145 \end{frame}
                 
)
Runaway argument?
---
I'm assuming something is not liking that dangling "}"...
Thoughts?
Now, a real-life example that used to work -- and still does!

#+LaTeX: {\fontsize{3.8}{4.2}\selectfont

#+BEGIN: columnview :hlines 1 :id local
| Task | Orig. | Time | Estim. | PRIOR | SCHEDULED | DEADLINE |
|----------------------+--------+--------+--------+-------+-----------+----------|
| * POC | 856:00 | 698:50 | 775:55 | | | |
| ** Setup | 32:00 | 2:00 | 10:00 | | | |
| *** Bugs or features | | 32:05 | 0:15 | | | |
| *** TODO Caching? | | | | | | |
#+END:

#+LaTeX: }

So, diffs are here:

- I'm using an explicit size
- I don't use LaTeX blocks but just LaTeX one-liners
Post by Nick Dokos
what stops it is YAB in the latex exporter, but having been bitten by
such a couple of times in the past, I applied my usual[fn:1] workaround
,----
|
| * foo
|
| #+begin_latex
| \scriptsize{ %}
| #+end_latex
|
| #+tblname: foo
| | table | here |
| |-------+------|
| | table | here |
|
| #+begin_latex
| }
| #+end_latex
`----
The opening brace on the \scriptsize line confuses the exporter and it
leaves the table alone. Adding a commented-out closing brace unconfuses
it.
[fn:1] Maybe I should add it to the FAQ?
Asking the question is answering it... ;-)

Best regards,
Seb
--
Sébastien Vauban
Loading...