Skip to content
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

cannot change caption format #66

Open
Fabian188 opened this issue Nov 3, 2019 · 6 comments
Open

cannot change caption format #66

Fabian188 opened this issue Nov 3, 2019 · 6 comments

Comments

@Fabian188
Copy link

By default float's caption setup has format=hang. This means that all lines of the caption text start right of "Figure 3.2: ". This can be changed by
\usepackage[format=plain,indention=.5cm]{caption}
or
\usepackage[format=plain]{caption}
which seems to be ignored for epub.

@michal-h21
Copy link
Owner

Try the following .cfg file:

\Preamble{xhtml}
% \Css{body{max-width:25em;}}
\Css{div.caption .id, div.caption .content{display: block;text-indent: 0;margin:0;}}
\Css{div.caption .id{float:left;max-width:4em;margin-left:-2em;}}
\Css{div.caption .content{margin-left:5em;}}
\begin{document}
\EndPreamble

I am not sure how the ebook readers will handle it, though. Their CSS support can be poor.

@Fabian188
Copy link
Author

Fabian188 commented Nov 4, 2019

That had the wrong effect: It moved the caption block to the left (and eats the beginning of the line) but it still ignores the caption format which shall be plain instead of hang. Is there a log file I can search for a reason?

Bildschirmfoto 2019-11-04 um 22 08 55

This is the code: It is a table (hang format)
`

<table class="caption"

Abbildung 2.1:

class="content">Der wohl berühmteste Bauwagen von Peter Lustig aus Löwenzahn.
CC-BY 3.0, Matthias Voss, Loewenzahn_Bauwagen.jpeg, wikipedia

I don't know how to escape the code example, therefore also a screenshot

Bildschirmfoto 2019-11-04 um 22 36 18

`

@Fabian188
Copy link
Author

Here is how it works with pdflatex

Bildschirmfoto 2019-11-04 um 22 16 29

@Fabian188
Copy link
Author

I almost resolved all my other issues? Is there a way to have the table for the caption omitted? Shall I provide more information (e.g. a MWE)? Thanks!

@michal-h21
Copy link
Owner

Ah, I understood your request incorrectly, I thought that you want to replicate the hang format. I think the plain format is used by tex4ht by default? the only difference from the PDF version I can see is that the bold font is used for caption in the HTML version. Does something like this work for you? :

\Preamble{xhtml}
\Css{div.caption span.id{font-weight: normal;}}
\Css{ div.caption {text-indent:-2em; margin-left:2em; text-align:left;}}
\begin{document}
\EndPreamble

@Fabian188
Copy link
Author

Fabian188 commented Nov 13, 2019

For me (tex4ebook v0.2c, newest on openSUSE tumbleweed) the default for cation is hang, even when set to plain via \usepackage[format=plain]{caption} it is ignored by tex4ebook. I attach screenshots for the pdflatex case (there the style is plain), the case with tex4ebook where it is the hang style (ignoring option plain) with tables. When I copy your 5 lines to a config file, the output is corrupt in Apple's Books reader. As there are html tables, I think we cannot do much with css configuration?!. Shall I try to provide a MWE?

pdflatex
Bildschirmfoto 2019-11-13 um 00 53 19

tex4ebook without config
Bildschirmfoto 2019-11-13 um 00 53 58

tex4ebook with your suggested config
Bildschirmfoto 2019-11-13 um 00 54 27

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

No branches or pull requests

2 participants