Forum How do I...?

Why do my tabs align differently in HTML and PDF

melusina
Unfortunately, we have a publication in which we could not avoid the use of tabs for alignment of segments within a line. I know that this is problematic. But, still I do not get completely why the same css and `tab-size` value produces a different alignment in the HTML that I hand over over to princexml and the PDF that is produced out of it (see below). Is there any way to assure that the PDF will have the same alignment as the HTML that pass to princexml?

Screenshot from 2020-06-12 11-47-23.png


Screenshot from 2020-06-12 11-51-30.png


The CSS:

p.example {
text-align: left;
text-indent: 0;
margin-top: 10pt;
margin-bottom: 10pt;
padding-left: 2.5em;
padding-right: 0;
break-inside: avoid;
hyphens: none;
font-size: 10pt;
tab-size: 8;
}

  1. Screenshot from 2020-06-12 11-47-23.png39.9 kB
  2. Screenshot from 2020-06-12 11-51-30.png61.1 kB

Edited by melusina

mikeday
Prince does not support the tab-size property yet, it would be necessary to use spaces or some other form of alignment.
melusina
Ok, that explains it. i somehow got the wrong impression that because it was listed in the documentation it is supported, but probably overlooked the section on not supported definitions. Thx for clarifying.
mikeday
Sorry, Prince does actually recognise the tab-size property but currently it only expands tab characters to the requested number of spaces without performing any alignment.
melusina
I tried spaces. I replaced the tabs by non-breaking spaces and aligned by adding or deleting spaces. However, even with this approach the html requires different number of spaces than the PDF. I do not understand this. The issue is that I use both html and pdf for the publication, so it would be really good to have consistent space between both representations.
mikeday
Perhaps they are using different fonts? There may be another another way to get the desired layout, for example you could use "float: right".
melusina
The font is the same in the HTML and the PDF. I used the 'float: right;' solution in other cases. It is true that it would work out here as well. However, there are many cases in which there is not only one fragment of a line aligned by tabs but several consecutively. In this case it would not work. Anyway, thx for your effort!

(We have a lot linguists and they require wired things in order to create complex language examples with translation spart-of-speech tagging etc. Is there any chance princexml will support alignment for the tab-size property as well?)