Skip to content

Allow multicols env in LaTeX reader #6449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ip1981
Copy link
Contributor

@ip1981 ip1981 commented Jun 9, 2020

The multicols environment has a mandatory argument - number of columns.
It is incorrectly parsed as plain string. Wrap multicols content into nested divs.

Signed-off-by: Igor Pashev pashev.igor@gmail.com

@ip1981 ip1981 force-pushed the ip1981/reader/latex/multicols branch 2 times, most recently from 28e949e to 929e103 Compare June 10, 2020 08:39
@jgm
Copy link
Owner

jgm commented Jun 12, 2020

Maybe even better, we could parse it into a structure with Divs.
This would give people a chance to do something with the structured data.

Div [("",["columns"],[])
  [ Div [("",["column"],[])
    [...]

We actually support this in beamer output.

@ip1981
Copy link
Contributor Author

ip1981 commented Jun 12, 2020

Maybe even better, we could parse it into a structure with Divs.
This would give people a chance to do something with the structured data.

Div [("",["columns"],[])
  [ Div [("",["column"],[])
    [...]

Agree! I just discovered that HTML/CSS support multi-columns docs nowadays (not very useful to me, though).
I think we then should keep the number of columns somehow, probably as a key-value pair?
And maybe use just one Div - I fail to see how the external Div might be helpful.

@jgm
Copy link
Owner

jgm commented Jun 13, 2020

There is one external div with class "columns", and N internal divs (where N = the number of columns) each with class "column".

@ip1981 ip1981 marked this pull request as draft June 19, 2020 14:59
@ip1981 ip1981 force-pushed the ip1981/reader/latex/multicols branch from 929e103 to ade67f7 Compare June 22, 2020 11:43
@ip1981 ip1981 marked this pull request as ready for review June 22, 2020 11:44
The multicols environment has a mandatory argument - number of columns.
It is incorrectly parsed as plain string.

Wrap multicols content into nested divs.

Signed-off-by: Igor Pashev <pashev.igor@gmail.com>
@ip1981 ip1981 force-pushed the ip1981/reader/latex/multicols branch from ade67f7 to aab5127 Compare June 22, 2020 11:45
[Div ("",["column"],[])
[Div ("",["column"],[])
[Para [Str "Hello"]]]]]
```
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may have misunderstood what I meant about two column Divs: the structure should be:

Div columns
[ Div column
, Div column ]

and not

Div columns
[ Div column
  [ Div column ...

Does that make more sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, what would be the content of the first div for example? Empty?

Div columns
[ Div column ""
, Div column "text foo hello"]

?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I need to understand better what you're trying to do.

The latex multicols environment creates columned text, but it computes where the column breaks go.
In order to duplicate this in pandoc we'd need pandoc to compute where a new column starts.
Is this something you're trying to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I am basically trying to ignore the number of columns in latex :)

\begin{multicols}{2} % <- here
% ...
\end{multicols}

There is nothing more we can do, I think.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, then maybe I led you astray in my advice to include the nested column divs.
Maybe it makes most sense simply to include an outer "columns" div, and then the content inside.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants