Tabs turn into spaces in PDF transformation

Post here questions and problems related to editing and publishing DITA content.
CindyLNG
Posts: 1
Joined: Wed Nov 30, 2022 4:09 pm

Tabs turn into spaces in PDF transformation

Post by CindyLNG »

Hello everyone,

I am working with Oxygen Author to write Dita content.
I am trying to write a content with a codeblock element. The code contains tabs which must be displayed as tabs in order for the users to copy and paste the code.
My problem is: When I enter a tab, and transform the document into a PDF, the tabs are replaced with spaces.
I tried: Using the attribute outputclass in the codeblock element with tab-width-O, using the pre element instead with the same attribute, typing the code in Sublime text and copypaste it in Oxygen, the author view displays the tabs but it turns into spaces when transformed to PDF.

Do you have a solution to keep the tabs in codeblock element when transforming to PDF ?
If it is not the right place to ask, please let me know if you use other platforms that might help.

Thank you in advance.

Cindy
julien_lacour
Posts: 373
Joined: Wed Oct 16, 2019 3:47 pm

Re: Tabs turn into spaces in PDF transformation

Post by julien_lacour »

Hi Cindy,

I will answer here for visibility and because it is Oxygen related:
By default we don't keep the tab character in the PDF transformation because in either PDF XSL-FO or PDF HTML5&CSS transformation the tab conversion is 1 to 1 (meaning that one tab in DITA will lead to one space in PDF).
This is also why by default in Oxygen indentation is made by spaces (with 2 or 4 spaces for example). If your DITA sources contains tabs, you can still use Oxygen Find/Replace dialog to make them spaces.

Besides that, we have remarked that Acrobat behavior isn't really consistent when copying and pasting content from it. In most of the cases the pasted content isn't indented at all (regardless of the character used).
If the indentation really matters to you, you could maybe link directly some code samples into the DITA sources by using xrefs (for example you can target the WebHelp output).

Regards,
Julien
Post Reply