"vendo.li...@libero.it" <vendo.li...@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