Closed ouboub closed 3 years ago
I see some misconfigurations. These images will tell you where the problems are:
You have misconfigured the styles:
OrgPage
style is NOT in landscape. You may have to fix it. OrgPage
is NOT APPLIED to the document pages. It is the default page style that is getting applied.If you examine the XML files you can see what is happening underneath.
In the zip file above you can see
OrgPage
is a portrait page, and Standard
is the landscape page just the way you have set it up)I have trouble understanding your description. It is not clear to me whether you want a landscape table in the middle of a portrait document, or you want a fully landscape document with a complex table somewhere in the middle with the page breaks. Whatever be the case, the new ODT exporter has you covered.
Here are a couple of things you need to note in the Org syntax. Once that is done, you are all set.
Remove the newlines below
#+ATTR_ODT: :width 15 :style "OrgPageImage" :anchor "page"
#+ATTR_ODT: :list-table t
The ATTR_ODT
lines should "touch" the paragraphs they are applied to. (When there are newlines, the Org parser will think that you are applying an attribute to an empty paragraph)
#+ATTR_ODT: :page-style "OrgPage" :page-break "after"
* Information
If the intention is to begin a chapter on a new page, DON'T add the pagebreak to the last paragraph of the previous chapter. Instead, add the page break right to the headings via the PROPERTIES
line. The example Org file shows what you can do.
As I said, I have trouble understanding your exact layout requirements. Based on my limited understanding, I have given you recipes for all possible scenarios.
"JK" == Jambunathan K @.***> writes:
uwe2.zip In the zip file above you can see
- Screenshots that explain where you need to focus on in the LibreOffice UI.
First of all a big thank you for your time and explanations.
Ok I have a confession to make, I am not longer a LO user anymore. I use either org mode and export it to odt (and then to docx, since this is the format my colleagues are using) or to latex (or I use auctex mode emacs directly).
That is why I have even trouble in obtaining the screenshots you sent to me. I looked in styles, I pressed the default style button and the button of my LO screen and obtain a slightly different screen displayed. (I am using LO 6.2). I attach a screenshot.
- A diff file that tells what modifications I have done to your file. The page breaks are applied to headings. There is a place where I have applied a break to a paragraph. Surrounding the table in a Frame may not be necessary since it seems that you are going to have large tables, and have page breaks surrounding it. So, the problem of "positioning" a table as a float may not arise.
- A modified Org file. (In these examples,
OrgPage
is a portrait page, andStandard
is the landscape page just the way you have set it up)- The exported ODT file that has a mix of landscape and portrait pages.
I have trouble understanding your description. It is not clear to me whether you want a landscape table in the middle of a portrait document, or you want a fully landscape document with a complex table somewhere in the middle with the page breaks. Whatever be the case, the new ODT exporter has you covered.
Thanks again, especially with the description below. Right now I am not sure what is best, everything in landscape or only the large table. I think your solution fits in my needs best.
I did not realize that the setting is so complex (I just thought, I set a pagebreak command here and there and change whenever it is convenient and play around like I do it when I compile latex). But I need to modify the ott file and take care with the orgmode styles.
Since I am, unfortunately, in a great hurry I will take your examples and will study the manual in carefully after the course ends.
Thanks again
Uwe
Sorry, you are going to kill me, but I just applied the converter to your modified
testbreak-page.org and I obtain a slightly different odt. it starts with an empty page, so I explicitly added
I also add to play around with the the line #+ATTR_ODT: :page-style "OrgPage" :page-break "after" before the information header: I sometimes had to uncomment it, otherwise the large table got split. In any case the current situation is ok Thanks uwe3.zip
Ok I have a confession to make, I am not longer a LO user anymore.
As a LO user, I can see when someone is (or is not) conversant with LO.
(I just thought, I set a pagebreak command here and there and change whenever it is convenient and play around like I do it when I compile latex
It is exactly like what you say.
Just export this standalone file. you don't have to do anything.
There is a reason why I don't recommend using#+PAGEBREAK:
. You can see the reason listed here https://github.com/kjambunathan/org-mode-ox-odt/blob/f022150f3a046511dba18a509de621ec35daf075/lisp/ox-odt.el#L3011.
There seems to be some regression when I export #+PAGEBREAK:
with an attribute. I will fix it in a moment or two.
I will also add a OrgLandscapePage
or some such style later today.
it starts with an empty page
It really doesn't. Do you remember that you need to turn off all the metadata options. This is precisely the reason.
The page styles gets attached to a paragraph empty or not. The documents metadata elements are typeset as paragraphs. This is precisely the reason why I have added this line.
#+ATTR_ODT: :style "OrgTitle" :page-style "OrgPageLandscape"
{{{title}}}
You Org file in uwe3.zip doesn't show any options. So, I can't say what it turns on or off. Do a C-c C-e #
(followed by default) and C-c C-e #
(followed by odt) so that I have some idea of what is in your defcustoms. These ultimately determine if there are going to be any leading paragraphs introduced by /possibly empty/ metadata.
it starts with an empty page
It really doesn't. Do you remember that you need to turn off all the metadata options. This is precisely the reason.
Forgot to attach the screenshot .... Here it is.
Thanks, a lot. I learn a ton of valuable information this way.
I obtain:
`#+options: ':nil *:t -:t ::t <:t H:7 \n:nil ^:t arch:headline
`
did not even know about it (well on a second thought I should, because this information pops up when I export to tex, I somehow thought, just not having anything, would not produce meta data, ok this is really lame, I confess
so I deleted text, author and all the meta stuff, and now it works as exspected
so I deleted text, author and all the meta stuff, and now it works as exspected
Happy to hear that.
What follows is a note intended for my own consumption ....
The whole day, I was trying to recollect the context in which I might have introduced #+PAGEBREAK:
in to the ODT exporter. It seems like I have fashioned it loosely after LO's Menu
->More Breaks
->Manual Break
-> ....
.
Subsequent changes I added in response to https://github.com/kjambunathan/org-mode-ox-odt/issues/29#issuecomment-342493728 seems to have slightly poisoned the original intention.
I need to review
#+PAGEBREAK:
could be made more meaningful. If not, I will remove it.OrgLandscapePage
style#+PAGEBREAK:
.There is a scope for improving the easy-of-specifying pagebreaks. Much of the infrastructure for specifying page breaks is already in place. How the nuts and bolts of pagebreak logic are assembled together by the user is (at present) NOT VERY INTUITIVE.
so I deleted text, author and all the meta stuff, and now it works as exspected Happy to hear that.
What follows is a note intended for my own consumption ....
The whole day, I was trying to recollect the context in which I might have introduced
#+PAGEBREAK:
in to the ODT exporter. It seems like I have fashioned it loosely after LO'sMenu
->More Breaks
->Manual Break
->....
.Subsequent changes I added in response to https://github.com/kjambunathan/org-mode-ox-odt/issues/29#issuecomment-342493728 seems to have slightly poisoned the original intention.
I need to review
- If
#+PAGEBREAK:
could be made more meaningful. If not, I will remove it.- Add default
OrgLandscapePage
style- See if there is a way to add default page style for the exported document without much hassle. Since the user can pick choose what meta information can or cannot appear, it becomes kind of messy to infer what the first paragraph (or the first block-level element) could be. (An use-case to think of is a document that has no parargraphs at the top level. For example, a document with no metadata but just a table that needs to be emitted in a landscape page.) Since the page break--and the specific-kind of page it wants for subsequent text--piggy backs on paragraph (or possibly other element like table) it doesn't make much sense to it piggyback on a "standalone" element like
#+PAGEBREAK:
.There is a scope for improving the easy-of-use. Much of the infrastructure for specifying page breaks is already in place. How the nuts and bolts of pagebreak logic are assembled together it is at present NOT VERY INTUITIVE.
I wholeheartedly agree. I there is any code you want me to test, please let me know.
BTW, I know his is a ox-exporter, but is there any possibility that these structures could be exported to LaTex in a similar way, I mean lists to tables?
BTW, I know his is a ox-exporter, but is there any possibility that these structures could be exported to LaTex in a similar way, I mean lists to tables?
Last time I wrote anything latex was some 20 or so years ago. Since I have not much experience, my judgement is going to be pretty weak. Also, since I have no immediate need, it is hard to muster any motivation to find a reliable solution. That said ....
If you haven't noticed it already, the example I have chosen for illustrating the List tables is from the LaTeX Wikibook, with the last column converted in to a list. And most examples that I have run across in the latex realm, that talk about tables, have some simple stuff in table cells. They hardly mention how to typeset a multi-paragraph content in a latex table.
Since you are familiar with LaTeX you can proceed the following way and "fix" whatever problems you bump in to. And if you have to get anything past Nicolas Goaziou, DO NOT suggest it as a change to Org syntax or Org parser. He will resist it.
When I put this in my .emacs
(with-eval-after-load 'ox-latex
(unless (featurep 'ox-odt)
(require 'ox-odt))
(add-to-list
'org-export-filter-parse-tree-functions
(defun org-html--translate-list-tables (tree backend info)
(if (eq backend 'latex)
(org-odt--translate-list-tables tree backend info)
tree))))
and export this
#+ATTR_ODT: :list-table t
-
- Day
- Min Temp
- Max Temp
- Summary
- ----------------
- Monday
- 11C
- 22C
-
1. A clear day with lots of sunshine.
2. Late in the day, a strong breeze will bring down the temperatures.
- ----------------
- Tuesday
- 9C
- 19C
-
1. Cloudy with rain, across many northern regions.
2. Clear spells across most of Scotland and Northern Ireland, but
rain reaching the far northwest.
... to tex, I get
% Created 2021-07-12 Mon 07:01
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\author{Jambunathan K}
\date{\today}
\title{}
\hypersetup{
pdfauthor={Jambunathan K},
pdftitle={},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 28.0.50 (Org mode 9.3.7)},
pdflang={English}}
\begin{document}
\tableofcontents
\begin{center}
\begin{tabular}{llll}
Day
& Min Temp
& Max Temp
& Summary
\\
\hline
Monday
& 11C
& 22C
& \begin{enumerate}
\item A clear day with lots of sunshine.
\item Late in the day, a strong breeze will bring down the temperatures.
\end{enumerate}
\\
\hline
Tuesday
& 9C
& 19C
& \begin{enumerate}
\item Cloudy with rain, across many northern regions.
\item Clear spells across most of Scotland and Northern Ireland, but
rain reaching the far northwest.
\end{enumerate}
\\
\end{tabular}
\end{center}
\end{document}
which is rendederd as
You can see that the paragraph is overflowing.
This is exactly what the LaTex Wikibook is saying. See https://en.wikibooks.org/wiki/LaTeX/Tables#Text_wrapping_in_tables
Text wrapping in tables
LaTeX\'s algorithms for formatting tables have a few shortcomings. One is that it will not automatically wrap text in cells, even if it overruns the width of the page. For columns that will contain text whose length exceeds the column\'s desired width, it is recommended that you use the [p] attribute and specify the desired width of the column (although it may take some trial-and-error to get the result you want). For a more convenient method, have a look at The tabularx package, or The tabulary package.
Instead of [p], use the [m] attribute to have the lines aligned toward the middle of the box or the [b] attribute to align along the bottom of the box.
Here is a simple example. The following code creates two tables with the same code; the only difference is that the last column of the second one has a defined width of 5 centimeters, while in the first one we didn\'t specify any width.
Here is a quick example, I picked from https://draft-edx-style-guide.readthedocs.io/en/latest/ExampleRSTFile.html#tables
When I take this rst
list table
.. list-table::
:widths: 25 25 50
* - Annotation Problem
-
- Annotation problems ask students to respond to questions about a
specific block of text. The question appears above the text when the
student hovers the mouse over the highlighted text so that students can
think about the question as they read.
* - Example Poll
- Conditional Module
- You can create a conditional module to control versions of content that
groups of students see. For example, students who answer "Yes" to a
poll question then see a different block of text from the students who
answer "No" to that question.
* - Example JavaScript Problem
- Custom JavaScript
- Custom JavaScript display and grading problems (also called *custom
JavaScript problems* or *JS input problems*) allow you to create a
custom problem or tool that uses JavaScript and then add the problem or
tool directly into Studio.
and do this
rst2latex listtable1.rst > listtable1.tex
I get
\documentclass[a4paper]{article}
% generated by Docutils <http://docutils.sourceforge.net/>
\usepackage{cmap} % fix search and cut-and-paste in Acrobat
\usepackage{ifthen}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{longtable,ltcaption,array}
\setlength{\extrarowheight}{2pt}
\newlength{\DUtablewidth} % internal use in tables
%%% Custom LaTeX preamble
% PDF Standard Fonts
\usepackage{mathptmx} % Times
\usepackage[scaled=.90]{helvet}
\usepackage{courier}
%%% User specified packages and stylesheets
%%% Fallback definitions for Docutils-specific commands
% hyperlinks:
\ifthenelse{\isundefined{\hypersetup}}{
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\usepackage{bookmark}
\urlstyle{same} % normal text font (alternatives: tt, rm, sf)
}{}
%%% Body
\begin{document}
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable}[c]{|p{0.315\DUtablewidth}|p{0.315\DUtablewidth}|p{0.315\DUtablewidth}|}
\caption{:widths: 25 25 50}\\
\hline
Annotation Problem
& &
Annotation problems ask students to respond to questions about a
specific block of text. The question appears above the text when the
student hovers the mouse over the highlighted text so that students can
think about the question as they read.
\\
\hline
Example Poll
&
Conditional Module
&
\begin{description}
\item[{You can create a conditional module to control versions of content that}] \leavevmode
groups of students see. For example, students who answer \textquotedbl{}Yes\textquotedbl{} to a
poll question then see a different block of text from the students who
answer \textquotedbl{}No\textquotedbl{} to that question.
\end{description}
\\
\hline
Example JavaScript Problem
&
Custom JavaScript
&
Custom JavaScript display and grading problems (also called \emph{custom
JavaScript problems} or \emph{JS input problems}) allow you to create a
custom problem or tool that uses JavaScript and then add the problem or
tool directly into Studio.
\\
\hline
\end{longtable}
\end{document}
which when processed with
pdflatex listtable1.tex
gets rendered as
Again I see that text is overflowing. The rst
example uses a simple paragraph for table cell, as opposed to a "multi" paragraph one.
Do you know what is best longtable
or tabular
or some other table package ....
Again I see that text is overflowing. The
rst
example uses a simple paragraph for table cell, as opposed to a "multi" paragraph one.
Once I removed the extra indentation
i.e., once I converted
- You can create a conditional module to control versions of content that
groups of students see. For example, students who answer "Yes" to a
poll question then see a different block of text from the students who
answer "No" to that question.
to
- You can create a conditional module to control versions of content that
groups of students see. For example, students who answer "Yes" to a
poll question then see a different block of text from the students who
answer "No" to that question.
I no longer get the overflow issue. I get a pretty pdf output.
The
rst
example uses a simple paragraph for table cell, as opposed to a "multi" paragraph one.
rst2latex
works for multi-paragraph text as well.
.. list-table::
:widths: 25 25 50
* - Annotation Problem
-
- Annotation problems ask students to respond to questions about a
specific block of text. The question appears above the text when the
student hovers the mouse over the highlighted text so that students can
think about the question as they read.
* - Example Poll
- Conditional Module
- You can create a conditional module to control versions of content that
groups of students see. For example, students who answer "Yes" to a
poll question then see a different block of text from the students who
answer "No" to that question.
- This is a list item This is a list item This is a list item
This is a list item This is a list item This is a list item
- This is a list item This is a list item This is a list item
This is a list item This is a list item This is a list item
* - Example JavaScript Problem
- Custom JavaScript
- Custom JavaScript display and grading problems (also called *custom
JavaScript problems* or *JS input problems*) allow you to create a
custom problem or tool that uses JavaScript and then add the problem or
tool directly into Studio.
get typeset as
\documentclass[a4paper]{article}
% generated by Docutils <http://docutils.sourceforge.net/>
\usepackage{cmap} % fix search and cut-and-paste in Acrobat
\usepackage{ifthen}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{longtable,ltcaption,array}
\setlength{\extrarowheight}{2pt}
\newlength{\DUtablewidth} % internal use in tables
%%% Custom LaTeX preamble
% PDF Standard Fonts
\usepackage{mathptmx} % Times
\usepackage[scaled=.90]{helvet}
\usepackage{courier}
%%% User specified packages and stylesheets
%%% Fallback definitions for Docutils-specific commands
% hyperlinks:
\ifthenelse{\isundefined{\hypersetup}}{
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\usepackage{bookmark}
\urlstyle{same} % normal text font (alternatives: tt, rm, sf)
}{}
%%% Body
\begin{document}
\setlength{\DUtablewidth}{\linewidth}
\begin{longtable}[c]{|p{0.315\DUtablewidth}|p{0.315\DUtablewidth}|p{0.315\DUtablewidth}|}
\caption{:widths: 25 25 50}\\
\hline
Annotation Problem
& &
Annotation problems ask students to respond to questions about a
specific block of text. The question appears above the text when the
student hovers the mouse over the highlighted text so that students can
think about the question as they read.
\\
\hline
Example Poll
&
Conditional Module
&
You can create a conditional module to control versions of content that
groups of students see. For example, students who answer \textquotedbl{}Yes\textquotedbl{} to a
poll question then see a different block of text from the students who
answer \textquotedbl{}No\textquotedbl{} to that question.
\begin{itemize}
\item This is a list item This is a list item This is a list item
This is a list item This is a list item This is a list item
\item This is a list item This is a list item This is a list item
This is a list item This is a list item This is a list item
\end{itemize}
\\
\hline
Example JavaScript Problem
&
Custom JavaScript
&
Custom JavaScript display and grading problems (also called \emph{custom
JavaScript problems} or \emph{JS input problems}) allow you to create a
custom problem or tool that uses JavaScript and then add the problem or
tool directly into Studio.
\\
\hline
\end{longtable}
\end{document}
and it gets rendered as
So, may be using a longtable
is the way to go.
I already see references to longtable
in ox-latex
, which is a good news. So, I think it is just a question of having the list table
use longtable
table environment.
May be you could cook up an export filter for that.
So, may be using a
longtable
is the way to go.I already see references to
longtable
inox-latex
, which is a good news. So, I think it is just a question of having thelist table
uselongtable
table environment.May be you could cook up an export filter for that.
For LaTeX export of a table, you can specify a label and a caption (see Images and tables). You can also use the ATTR_LaTeX line to request a longtable environment for the table, so that it may span several pages, or to change the default table environment from table to table* or to change the default inner tabular environment to tabularx or tabulary. Finally, you can set the alignment string, and (with tabularx or tabulary) the width.
https://orgmode.org/manual/Tables-in-LaTeX-export.html
So, it is just a question of setting the widths and setting an attribute. Probably, I can make my parse filter accommodate latex and html exports. Let me see if I can cook up something, and it seems doable only if it is a question of setting up an ATTR_LATEX
here and there.
So, it is just a question of setting the widths and setting an attribute. Probably, I can make my parse filter accommodate latex and html exports. Let me see if I can cook up something, and it seems doable only if it is a question of setting up an
ATTR_LATEX
here and there.
Good news ... It is just a matter of carrying over the latex attribute to the translated table. Can you try this ....
replicate this line https://github.com/kjambunathan/org-mode-ox-odt/blob/f022150f3a046511dba18a509de621ec35daf075/lisp/ox-odt.el#L5795
i.e.,
:attr_odt (org-element-property :attr_odt l1-list)
but with :attr_latex
as well, like so
:attr_odt (org-element-property :attr_odt l1-list)
:attr_latex (org-element-property :attr_latex l1-list)
and export with the following snippet in your .emacs
(with-eval-after-load 'ox-latex
(unless (featurep 'ox-odt)
(require 'ox-odt))
(add-to-list
'org-export-filter-parse-tree-functions
(defun org-html--translate-list-tables (tree backend info)
(if (eq backend 'latex)
(org-odt--translate-list-tables tree backend info)
tree))))
When I do the above steps, and I export the following org
snippet,
#+options: tex:t
#+description:
#+keywords:
#+subtitle:
#+odt_preferred_output_format: pdf
#+odt_styles_file:
#+odt_extra_images:
#+odt_extra_styles:
#+odt_extra_automatic_styles:
#+odt_master_styles:
#+odt_content_template_file:
#+odt_automatic_styles:
#+odt_display_outline_level: 2
#+odt_endnote_regexp: ^$
#+bib_file:
#+ATTR_LATEX: :environment longtable :align {|p{0.315\linewidth}|p{0.315\linewidth}|p{0.315\linewidth}|p{0.315\linewidth}|}
#+ATTR_ODT: :list-table t
-
- Day
- Min Temp
- Max Temp
- Summary
- ----------------
- Monday
- 11C
- 22C
-
1. A clear day with lots of sunshine.
2. Late in the day, a strong breeze will bring down the temperatures.
- ----------------
- Tuesday
- 9C
- 19C
-
1. Cloudy with rain, across many northern regions.
2. Clear spells across most of Scotland and Northern Ireland, but
rain reaching the far northwest.
I get
% Created 2021-07-12 Mon 09:07
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\author{Jambunathan K}
\date{\today}
\title{}
\hypersetup{
pdfauthor={Jambunathan K},
pdftitle={},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 28.0.50 (Org mode 9.3.7)},
pdflang={English}}
\begin{document}
\tableofcontents
\begin{longtable}{{|p{0.315\linewidth}|p{0.315\linewidth}|p{0.315\linewidth}|p{0.315\linewidth}|}}
Day
& Min Temp
& Max Temp
& Summary
\\
\hline
\endfirsthead
\multicolumn{4}{l}{Continued from previous page} \\
\hline
Day
& Min Temp
& Max Temp
& Summary
\\
\hline
\endhead
\hline\multicolumn{4}{r}{Continued on next page} \\
\endfoot
\endlastfoot
\hline
Monday
& 11C
& 22C
& \begin{enumerate}
\item A clear day with lots of sunshine.
\item Late in the day, a strong breeze will bring down the temperatures.
\end{enumerate}
\\
\hline
Tuesday
& 9C
& 19C
& \begin{enumerate}
\item Cloudy with rain, across many northern regions.
\item Clear spells across most of Scotland and Northern Ireland, but
rain reaching the far northwest.
\end{enumerate}
\\
\end{longtable}
\end{document}
which gets rendered as
or as
The output suggests that I just need to tweak the column widths so that they don't add up to more than pagewidth.
Please experiment and suggest how I can change the parse filter to better suit a latex-user needs.
It is basically one or two line tweak. Yes, it is doable.
Wow, thanks a lot, I asked a question, go to bed and you solved the issue. That is fantastic, thanks a lot
Hi I want a pagebreak before a table and then after it using landscape (and for that a ott file) testbreak.zip Please see the attached files