From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Giepen Subject: Problem with threeparttable and sidewaystable, or: change request for (org-latex-tables-centered) behaviour Date: Fri, 5 Feb 2016 19:59:42 +0100 Message-ID: <56B4F11E.9030600@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRlbi-0007q3-1o for emacs-orgmode@gnu.org; Fri, 05 Feb 2016 13:59:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRlbd-0003IA-To for emacs-orgmode@gnu.org; Fri, 05 Feb 2016 13:59:49 -0500 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:37452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRlbd-0003I2-I9 for emacs-orgmode@gnu.org; Fri, 05 Feb 2016 13:59:45 -0500 Received: by mail-wm0-x22e.google.com with SMTP id g62so40225557wme.0 for ; Fri, 05 Feb 2016 10:59:45 -0800 (PST) Received: from [192.168.1.106] ([83.231.121.87]) by smtp.googlemail.com with ESMTPSA id w80sm32280507wme.17.2016.02.05.10.59.43 for (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Feb 2016 10:59:43 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * Problem with centering sidewaystable and threeparttable #+LATEX_HEADER: \usepackage{threeparttable} I am referring myself to an archived post about using "threeparttable" with org-mode syntax(!), without having to use a LaTeX code block: https://lists.gnu.org/archive/html/emacs-orgmode/2013-12/msg00446.html I am having trouble achieving the following goals: - booktabs table (just mentioning, do not think that matters) - threeparttable in org-mode syntax - floating environment --> place threeparttable inside "table environment" - table centered! -> here is the problem! ** threeparttable floating threeparttable example (non-floating would not be a problem): #+CAPTION: Here goes the caption #+BEGIN_table #+BEGIN_threeparttable | An example of a \tnote{a} | threeparttable | centered table \tnote{c} | | 1 | 2 | 3 | #+BEGIN_tablenotes \item[a] To float one has to put threeparttable (TPT) in a table environment \item[b] With default (org-latex-tables-centered) on TPT gets exportet in "center" environment \item[c] "center" environment and TPT clash, no document export #+END_tablenotes #+END_threeparttable #+END_table The LaTeX export is: (uses \begin{center}...\end{center} # ############################################################### \begin{table}[!htpb] \caption{\label{tab:} Here goes the caption} \begin{threeparttable} \begin{center} \begin{tabular}{lll} \toprule a \tnote{a} & table \tnote{b} & example \tnote{c}\\ \bottomrule \end{tabular} \end{center} \begin{tablenotes} \item[a] To float one has to put threeparttable (TPT) in a table environment \item[b] With default (org-latex-tables-centered) on TPT gets exportet in "center" environment \item[c] "center" environment and TPT clash, no document export \end{tablenotes} \end{threeparttable} \end{table} # ############################################################### The "center environment" within threeparttable does not export! Just as a comparison a standard table export: #+CAPTION: Standard table | Standard | simple | table | becomes exported to: (uses centering!) \begin{table}[!htbp] \caption{Standard table} \centering \begin{tabular}{lll} \toprule Standard & simple & table\\ \bottomrule \end{tabular} \end{table} If the \centering would also be used for threeparttable or any environment, there would be no conflict at all (I think). I do not really understand why why the center environment is used in the first place: it apparently causes conflicts with several environments, but in effect seems to be no different from the center environment. I think that should be changed to always use centering. Anyways, my workaround solution, which works nicely so far is: 'org-latex-tables-centered nil plus adding #+LATEX_HEADER: \makeatletter #+LATEX_HEADER: \g@addto@macro\@floatboxreset\centering #+LATEX_HEADER: \makeatother so that any float becomes centered. * sidewaystable Now, with the threeparttable problem solved, I now get a new problem with sidewaystables, which are now left-aligned (bottom of the page) with 'org-latex-tables-centered nil. #+CAPTION: sidewaystable #+LABEL: tab:sidewaystable #+ATTR_LATEX: :float sideways | Some | random | headers | in | sideways | table | with | random | content | |------+--------+---------+--------+----------+-------+------+--------+---------| | 4.0 | 0.4 | 1.0 | 456 | 5465 | 465 | 65 | 645 | 46 | | 4.0 | 0.49 | 654 | 546546 | 654 | 546 | 54 | 654 | 654 | To solve this I have tried: #+BEGIN_center #+CAPTION: sidewaystable #+LABEL: tab:sidewaystable #+ATTR_LATEX: :float sideways | Some | random | headers | in | sideways | table | with | random | content | |------+--------+---------+--------+----------+-------+------+--------+---------| | 4.0 | 0.4 | 1.0 | 456 | 5465 | 465 | 65 | 645 | 46 | | 4.0 | 0.49 | 654 | 546546 | 654 | 546 | 54 | 654 | 654 | #+END_center --> no effect #+CAPTION: sidewaystable #+LABEL: tab:sidewaystable #+ATTR_LATEX: :float sideways #+BEGIN_center | Some | random | headers | in | sideways | table | with | random | content | |------+--------+---------+--------+----------+-------+------+--------+---------| | 4.0 | 0.4 | 1.0 | 456 | 5465 | 465 | 65 | 645 | 46 | | 4.0 | 0.49 | 654 | 546546 | 654 | 546 | 54 | 654 | 654 | #+END_center --> as the table is not "connected to the header the header is not considered on export. and adding #+ATTR_LATEX: :center --> no effect on export at all (no center command appears...). I thought that this one turns 'org-latex-tables-centered on a float basis... Nothing works... One solution would be a workaround for the sidewaystable with the 'org-latex-tables-centered turned off. Any ideas? If not, would it be possible to permanently change "center environment" for \centering with the "org-latex-tables-centered" option turned on? Or would this brake something else? P.S. details on my setup: emacs: 24.4.1 org-mode version: 20160201 from official repository Latex packages loaded on org-mode latex export: # \documentclass[11pt]{scrartcl} # \usepackage[utf8]{inputenc} # \usepackage[T1]{fontenc} # \usepackage{fixltx2e} # \usepackage{graphicx} # \usepackage{grffile} # \usepackage{longtable} # \usepackage{wrapfig} # \usepackage{rotating} # \usepackage[normalem]{ulem} # \usepackage{amsmath} # \usepackage{textcomp} # \usepackage{amssymb} # \usepackage{capt-of} # \usepackage{hyperref} # \usepackage{enumitem} # \usepackage{subcaption} # \usepackage{multirow} # \usepackage{natbib} # \usepackage{booktabs} # \usepackage{authblk} # \usepackage{afterpage} # \usepackage{nth} # \usepackage{makeidx} # \usepackage{tikz} # \usepackage{chemmacros} # \usepackage{siunitx} # \usepackage{chngcntr} # \counterwithin{figure}{section}