emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* tabularx from org to latex not recognized
@ 2016-05-01 22:21 vendo.libri
  2016-05-02  0:39 ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: vendo.libri @ 2016-05-01 22:21 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2741 bytes --]

Hello Org-mode users' group, 
I'm having trouble with tables, in particular with trying to get Org-mode to understand the attributes in #+ATTR_LATEX. I have a 7x3 (rows x columns) table that has lots of text in the 2 column. This means I can't properly see the table if Emacs' window is reduced rather than in full-screen view. The rows and column are all jumbled up. I've read in the Org online manual (section 3.2) that you must type something like <n> where n is an integer so that the column restricts the number of visible characters in an otherwise overflowing text. I've tried it by placing <10> in the header of the column but it doesn't work. Can someone help me out? 
Furthermore, when I try to get the pdf via LaTeX export (C-c C-e l o), in spite of adding the necessary package to #+LATEX_HEADER and to the add-to-alist within the .emac configuration file, the table gets exported in a "tabular" environment instead of "tabularx" which allows for adaptable columns. In LaTeX it should be:
\begin{table}[htb]  \centering  \begin{tabularx}{\textwidth}{lXX}\toprule    NAME &amp; CHARACTERISTICS &amp; EXAMPLES\\[...]
I've read extensively sec.12.7.5 of the org-manual but I don't know how to get {\textwidth}{lXX} for tabularx recognized by Org-mode. Can someone show me how, with an example specific to my case? 
Here's some of the preamble from my org file. I've since continued to type the document in LaTeX because the org-exported pdf had an overflowing table that I couldn't control. Can someone shed some light into all this matter, please?
#+TITLE: My Title#+AUTHOR: Me#+DATE: April 2016#+STARTUP: nolatexpreview align#+OPTIONS: toc:nil#+LATEX_CLASS: article#+LATEX_CLASS_OPTIONS: [a4paper,10pt]#+ATTR_LATEX: :booktabs :environment tabularx :width textwidth :align lXX[...]
#+LATEX_HEADER: \usepackage{tabularx,booktabs}
#+LATEX_HEADER: \setcounter{secnumdepth}{0}[...]

This is how the table appears if I use TAB to hop from one field to the other.
| NAME              | CHARACTERISTICS                                                                                                                                                                    | EXAMPLES                               ||-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------|| Metals            | <10> metallic bonding: adjacent atoms share electrons in a non-directional way; opaque, shiny, electrically conductive, they reflect photons, light rays from the environment      | a metal pan                            |

Any help is highly appreciated. Thank you.

[-- Attachment #2: Type: text/html, Size: 4022 bytes --]

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

* Re: tabularx from org to latex not recognized
  2016-05-01 22:21 vendo.libri
@ 2016-05-02  0:39 ` Nick Dokos
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Dokos @ 2016-05-02  0:39 UTC (permalink / raw)
  To: emacs-orgmode

"vendo.libri@libero.it" <vendo.libri@libero.it> writes:

> Hello Org-mode users' group, 
>
> I'm having trouble with tables, in particular with trying to get Org-mode to understand the attributes in #+ATTR_LATEX. 
> I have a 7x3 (rows x columns) table that has lots of text in the 2 column. This means I can't properly see the table if Emacs' window is reduced rather than in full-screen view. The rows
> and column are all jumbled up. I've read in the Org online manual (section 3.2) that you must type something like <n> where n is an integer so that the column restricts the number of
> visible characters in an otherwise overflowing text. I've tried it by placing <10> in the header of the column but it doesn't work. Can someone help me out? 
>
> Furthermore, when I try to get the pdf via LaTeX export (C-c C-e l o), in spite of adding the necessary package to #+LATEX_HEADER and to the add-to-alist within the .emac configuration
> file, the table gets exported in a "tabular" environment instead of "tabularx" which allows for adaptable columns. In LaTeX it should be:
>
> \begin{table}[htb]
>   \centering
>   \begin{tabularx}{\textwidth}{lXX}
> \toprule
>     NAME & CHARACTERISTICS & EXAMPLES\\
> [...]
>
> I've read extensively sec.12.7.5 of the org-manual but I don't know how to get {\textwidth}{lXX} for tabularx recognized by Org-mode. Can someone show me how, with an example specific to
> my case? 
>
> Here's some of the preamble from my org file. I've since continued to type the document in LaTeX because the org-exported pdf had an overflowing table that I couldn't control. Can someone
> shed some light into all this matter, please?
>
> #+TITLE: My Title
> #+AUTHOR: Me
> #+DATE: April 2016
> #+STARTUP: nolatexpreview align
> #+OPTIONS: toc:nil
> #+LATEX_CLASS: article
> #+LATEX_CLASS_OPTIONS: [a4paper,10pt]
> #+ATTR_LATEX: :booktabs :environment tabularx :width textwidth :align lXX
> [...]
> #+LATEX_HEADER: \usepackage{tabularx,booktabs}
> #+LATEX_HEADER: \setcounter{secnumdepth}{0}
> [...]
>
> This is how the table appears if I use TAB to hop from one field to the other.
>
> | NAME              | CHARACTERISTICS                                                                                                                                                      
>              | EXAMPLES                               |
> |
> -------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------
> |
> | Metals            | <10> metallic bonding: adjacent atoms share electrons in a non-directional way; opaque, shiny, electrically conductive, they reflect photons, light rays from the
> environment      | a metal pan                            |
>
> Any help is highly appreciated. Thank you.

The <width> specification is on a row of its own, in the same column
that it is supposed to control. Try the following:

--8<---------------cut here---------------start------------->8---
#+ATTR_LATEX: :environment tabularx :width \textwidth :align lXl
| NAME   | CHARACTERISTICS      | EXAMPLES    |
|--------+----------------------+-------------|
|        | <20>                 |             |
| Metals | metallic bonding: adjacent atoms share electrons in a non-directional way; opaque, shiny, electrically conductive, they reflect photons, light rays from the Qenvironment | a metal pan |

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

--
Nick

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

* Re: tabularx from org to latex not recognized
@ 2016-05-03 14:04 vendo.libri
  0 siblings, 0 replies; 6+ messages in thread
From: vendo.libri @ 2016-05-03 14:04 UTC (permalink / raw)
  To: emacs-orgmode, ndokos

[-- Attachment #1: Type: text/plain, Size: 2277 bytes --]

Hello Nick, 
Thank you for fixing the <10> character-width problem with the 2nd column of the table in Org-mode problem, your solution worked. Now the table is much more legible, within Emacs' reduced window.
Unfortunately the ultimate pdf if still giving problems. The table is too wide and the text overflows well beyond the right page limit. Something's not working in the preamble. Let me post the whole thing here:
#+TITLE: MS#+AUTHOR:  Me#+DATE: April 2016#+STARTUP: nolatexpreview align#+OPTIONS: toc:nil#+LATEX_CLASS: article#+LATEX_CLASS_OPTIONS: [a4paper,10pt]
#+ATTR_LATEX: :environment tabularx :width \textwidth :align lXl
#+LATEX_HEADER: \usepackage{esdiff}#+LATEX_HEADER: \usepackage[version=4]{mhchem}#+LATEX_HEADER: \usepackage{amssymb}#+LATEX_HEADER: \usepackage{siunitx}#+LATEX_HEADER: \usepackage{tabularx,booktabs}#+LATEX_HEADER: \setcounter{secnumdepth}{0}#+LATEX_HEADER: \usepackage[margin=1in]{geometry}#+LATEX_HEADER: \frenchspacing \allowdisplaybreaks#+LATEX_HEADER: \usepackage{fancyhdr}#+LATEX_HEADER: \pagestyle{fancy} % choose page-style#+LATEX_HEADER: \fancyhf{}  % erase and clean up#+LATEX_HEADER: \fancyhf[HLE,HRO]{\thepage} % H or F=Header or Footer, LCR=Left, Centre, Right#+LATEX_HEADER: \fancyhf[HC]{Materials Science: 10 Things\dots}
PS: Say I want to see what's "hidden" in the table due to the <10> (or <20>) character self-imposed limit, how can I do that via keyboard shortcut? Can it be done?
--------------------------------------------------------From: Nick Dokos <ndokos <at> gmail.com>Subject: Re: tabularx from org to latex not recognizedNewsgroups: gmane.emacs.orgmode

The <width> specification is on a row of its own, in the same columnthat it is supposed to control. Try the following:
--8<---------------cut here---------------start------------->8---#+ATTR_LATEX: :environment tabularx :width \textwidth :align lXl| NAME   | CHARACTERISTICS      | EXAMPLES    ||--------+----------------------+-------------||        | <20>                 |             || Metals | metallic bonding: adjacent atoms share electrons in a non-directional way; opaque, shiny,electrically conductive, they reflect photons, light rays from the Qenvironment | a metal pan |
--8<---------------cut here---------------end--------------->8---
--Nick

[-- Attachment #2: Type: text/html, Size: 3107 bytes --]

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

* Re: tabularx from org to latex not recognized
       [not found] <353cd935a9364ccc82fa15105e65d4a5@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2016-05-03 15:07 ` Eric S Fraga
  2016-05-03 15:47   ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2016-05-03 15:07 UTC (permalink / raw)
  To: vendo.libri@libero.it; +Cc: ndokos@gmail.com, emacs-orgmode@gnu.org

On Tuesday,  3 May 2016 at 14:04, vendo.libri@libero.it wrote:
> Hello Nick,
>
> Thank you for fixing the <10> character-width problem with the 2nd
> column of the table in Org-mode problem, your solution worked. Now the
> table is much more legible, within Emacs' reduced window.
>
> Unfortunately the ultimate pdf if still giving problems. The table is
> too wide and the text overflows well beyond the right page
> limit. Something's not working in the preamble. Let me post the whole
> thing here:

Works for me with Nick's table and just the tabularx package included.

> PS: Say I want to see what's "hidden" in the table due to the <10> (or
> <20>) character self-imposed limit, how can I do that via keyboard
> shortcut? Can it be done?

C-c `

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.92.1, Org release_8.3.4-739-g789412

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

* Re: tabularx from org to latex not recognized
  2016-05-03 15:07 ` tabularx from org to latex not recognized Eric S Fraga
@ 2016-05-03 15:47   ` Nick Dokos
  2016-05-03 20:35     ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2016-05-03 15:47 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Tuesday,  3 May 2016 at 14:04, vendo.libri@libero.it wrote:
>> Hello Nick,
>>
>> Thank you for fixing the <10> character-width problem with the 2nd
>> column of the table in Org-mode problem, your solution worked. Now the
>> table is much more legible, within Emacs' reduced window.
>>
>> Unfortunately the ultimate pdf if still giving problems. The table is
>> too wide and the text overflows well beyond the right page
>> limit. Something's not working in the preamble. Let me post the whole
>> thing here:
>
> Works for me with Nick's table and just the tabularx package included.
>

The OP should try moving the #+ATTR_LATEX line to just before the table.
I'm not sure, but I don't think it applies long distance.

>> PS: Say I want to see what's "hidden" in the table due to the <10> (or
>> <20>) character self-imposed limit, how can I do that via keyboard
>> shortcut? Can it be done?
>
> C-c `

Or hover over the item: the full text appears in a tool tip, but the
C-c ` is much nicer for editing.

--
Nick

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

* Re: tabularx from org to latex not recognized
  2016-05-03 15:47   ` Nick Dokos
@ 2016-05-03 20:35     ` Nick Dokos
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Dokos @ 2016-05-03 20:35 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:


> The OP should try moving the #+ATTR_LATEX line to just before the table.
> I'm not sure, but I don't think it applies long distance.
>

I checked, so now I'm sure :-) - see the org-syntax document on Worg,
section "Affiliated Keywords"
(http://orgmode.org/worg/dev/org-syntax.html#Affiliated_keywords):

,----
| Affiliated Keywords
| 
| With the exception of inlinetasks, items, planning, clocks, node
| properties and table rows, every other element type can be assigned
| attributes.
| 
| This is done by adding specific keywords, named “affiliated keywords”,
| just above the element considered, no blank line allowed.
| 
| Affiliated keywords are built upon one of the following patterns:
| “#+KEY: VALUE”, “#+KEY[OPTIONAL]: VALUE” or “#+ATTR_BACKEND: VALUE”.
|
| ...
`----

--
Nick

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

end of thread, other threads:[~2016-05-03 20:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <353cd935a9364ccc82fa15105e65d4a5@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-05-03 15:07 ` tabularx from org to latex not recognized Eric S Fraga
2016-05-03 15:47   ` Nick Dokos
2016-05-03 20:35     ` Nick Dokos
2016-05-03 14:04 vendo.libri
  -- strict thread matches above, loose matches on Subject: below --
2016-05-01 22:21 vendo.libri
2016-05-02  0:39 ` Nick Dokos

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

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

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