emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* should a "wrapped" table result behave differently than one that is not?
@ 2022-01-18 17:05 Eric S Fraga
  2022-01-18 18:43 ` Berry, Charles
  0 siblings, 1 reply; 3+ messages in thread
From: Eric S Fraga @ 2022-01-18 17:05 UTC (permalink / raw)
  To: Emacs Org mode mailing list

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

Dear all,

Should the export of a table that is the result of a code block and has
been wrapped in a RESULTS special block be different than one that is
not wrapped (beyond the wrapping, of course)?  Specifically, wrapping
the results seems to cause org to ignore that ATTR_LATEX :center toggle
[1].  A minimal example, both org and resulting LaTeX, attached.

I guess it makes sense in that the attr line will probably be applied to
the results special block.  I am not sure how to get around this.
Suggestions very welcome indeed!  I do need to wrap the results in a
block of some type so I can control the formatting in the resulting PDF
export but I do not want the table centred necessarily [2].

Thank you,
eric

Footnotes:
[1] describing this as a toggle (in the info manual) does not really
     make much sense to me as it implies a known initial state which is
     not specified in the manual.  I would prefer to have to say
     ":center no" (or nil) which then allows for ":center t"...?

[2] centring should happen by request, not by default, in my opinion, as
     it is trivial to enclose a table in a centring environment
     explicitly but difficult to remove otherwise.

-- 
: Eric S Fraga, with org release_9.5.2-306-g9623da in Emacs 29.0.50


[-- Attachment #2: t.org --]
[-- Type: application/vnd.lotus-organizer, Size: 623 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: t.tex --]
[-- Type: text/x-tex, Size: 1165 bytes --]

% Created 2022-01-18 Tue 16:52
% Intended LaTeX compiler: pdflatex
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{soul}
\usepackage{listings}
\usepackage[version=3]{mhchem}
\usepackage{doi}
\usepackage{amsmath}
\usepackage[british, english]{babel}
\author{Eric S Fraga}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={Eric S Fraga},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 29.0.50 (Org mode 9.5.2)}, 
 pdflang={English}}
\begin{document}

\tableofcontents

A bare table gets exported properly:

\begin{tabular}{rr}
1 & 2\\
3 & 4\\
\end{tabular}

Now a table that is the result of some code:

\begin{tabular}{rr}
1 & 2\\
3 & 4\\
\end{tabular}

and finally a table from some code but wrapped:

\begin{results}
\begin{center}
\begin{tabular}{rr}
1 & 2\\
3 & 4\\
\end{tabular}
\end{center}
\end{results}

The last table is centred unfortunately.
\end{document}

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

* Re: should a "wrapped" table result behave differently than one that is not?
  2022-01-18 17:05 should a "wrapped" table result behave differently than one that is not? Eric S Fraga
@ 2022-01-18 18:43 ` Berry, Charles
  2022-01-19  7:15   ` Eric S Fraga
  0 siblings, 1 reply; 3+ messages in thread
From: Berry, Charles @ 2022-01-18 18:43 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Emacs Org mode mailing list

Eric,

> On Jan 18, 2022, at 9:05 AM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
> 
> been wrapped in a RESULTS special block be different than one that is
> not wrapped (beyond the wrapping, of course)?  Specifically, wrapping
> the results seems to cause org to ignore that ATTR_LATEX :center toggle
> [1].  A minimal example, both org and resulting LaTeX, attached.
> 
> I guess it makes sense in that the attr line will probably be applied to
> the results special block.  I am not sure how to get around this.
> Suggestions very welcome indeed!  I do need to wrap the results in a
> block of some type so I can control the formatting in the resulting PDF
> export but I do not want the table centred necessarily [2].
> 


This is annoying, but I think you can get the product you want by "pre-wrapping" the results.

Here is an example:

#+begin_src org
  Show default:

  ,#+begin_src emacs-lisp :exports both
  org-latex-tables-centered
  ,#+end_src

  ,#+name: awrappedtable
  ,#+header: :exports results
  ,#+header: :results value
  ,#+begin_src emacs-lisp
    '((1 2) (3 4))
  ,#+end_src

  ,#+begin_results
  ,#+attr_latex: :center nil
  ,#+RESULTS: awrappedtable
  : initial filler
  ,#+end_results
#+end_src


On export I get

Show default:

\begin{verbatim}
org-latex-tables-centered
\end{verbatim}

\begin{verbatim}
t
\end{verbatim}


\begin{results}
\begin{tabular}{rr}
1 & 2\\
3 & 4\\
\end{tabular}
\end{results}


HTH,
Chuck





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

* Re: should a "wrapped" table result behave differently than one that is not?
  2022-01-18 18:43 ` Berry, Charles
@ 2022-01-19  7:15   ` Eric S Fraga
  0 siblings, 0 replies; 3+ messages in thread
From: Eric S Fraga @ 2022-01-19  7:15 UTC (permalink / raw)
  To: Berry, Charles; +Cc: Emacs Org mode mailing list

Hi Chuck,

On Tuesday, 18 Jan 2022 at 18:43, Berry, Charles wrote:
> This is annoying, but I think you can get the product you want by
> "pre-wrapping" the results.

Ah, I see: do the wrapping manually instead of using the :wrap header
argument.  Yes, this works.  A little annoying but it's a solution and
easy enough to do.  It's not as if I have that many results that need
this processing.  Thank you.

eric
-- 
: Eric S Fraga, with org release_9.5.2-306-g9623da in Emacs 29.0.50


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

end of thread, other threads:[~2022-01-19  7:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 17:05 should a "wrapped" table result behave differently than one that is not? Eric S Fraga
2022-01-18 18:43 ` Berry, Charles
2022-01-19  7:15   ` Eric S Fraga

Code repositories for project(s) associated with this 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).