Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 997527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:02:56+00:00 2026-05-16T07:02:56+00:00

I’ve tried using LaTeX and DocBook for documenting programming tools, to get PDF output.

  • 0

I’ve tried using LaTeX and DocBook for documenting programming tools, to get PDF output. What I’ve found is that these tools are excellent in some ways – easily versioned, and generating very usable PDF manuals. But there is a serious flaw. Code-snippets cannot simply be cut-and-pasted out of the PDF.

With DocBook, the problem is the loss of whitespace – mostly for indentation, but any repeated spaces seem to get stripped out. So, once you paste the snippet into a text editor, you’ll need to clean up the indentation and vertical alignment. Not too much hassle for two or three lines, but it quickly gets annoying.

With LaTeX – well, it’s a mess. The following was taken from a PDF generated using the LaTeX in MikTeX 2.8.

node myclas s
f f i e l d f i e l d 0 1 : i n t ;
f i e l d f i e l d 0 2 : ” char ” ;
g;

The intended example is…

node myclass
{
  field field01 : int;
  field field02 : "char*";
};

Other than the fact LaTeX plays with the quotes, the intended form is what you see in Adobe Reader – but not much like what you get from a cut-and-paste. Don’t ask me what’s going on with the spaces, or why the braces turned into letters, or what happened to the asterisk – I don’t know!

Mostly, I’ve noticed these things playing with ways of keeping my own personal notes, and just went back to other ways. Some notes are in HTML or plain text, so I can version them. Others are in an old Journal program I’ve used for years. But I’ve written a tool that I may want to release soon – and I’ll want to include a usable PDF manual, which will need to include examples.

So – is there a way of creating PDF documentation where the code snippets can be easily cut-and-pasted? Preferably a way that allows me to keep “sources” in versioned text files.

EDIT

Any solution must be portable. I will need to use it on Linux and on Windows XP.

EDIT

It looks like this may be impossible.

I’ve tried printing from Notepad++ to the Adobe Acrobat Pro 7 printer driver. The resulting document looked fine, but cutting and pasting gave the same missing whitespace problems as occur with DocBook.

I tried using the touchup text tool in Acrobat Pro to add leading spaces. These are preserved when you save and reload – but when you select text normally in acrobat, they aren’t included. You can only cut-and-paste including those spaces using the touchup text tool, so far as I can tell, which is obviously not included in reader.

In other words, this looks like a fundamental limitation – not of the PDF format itself so much as the tools that work with it. There appears to be a general assumption at work here that whitespace is insignificant – which for my purposes obviously isn’t true.

EDIT

One solution may be a “text field”. I can add these fairly easily using Acrobat Pro, can set a fixed width font, enter multiple lines of text and make the field read only. In Acrobat Pro 7, the text in the field then isn’t selectable – but in Reader 9 it is selectable and everything is preserved when you cut and paste.

The question is – can text fields be generated directly using some kind of markup language that is usable to create complete manuals?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:02:57+00:00Added an answer on May 16, 2026 at 7:02 am

    I’d suggest enscript. I use it for producing archives and documentations.
    Also, you can merge multiple source codes ps’ed with enscript into another pdf.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 483k
  • Answers 483k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer When you say "if something happens to my domain name",… May 16, 2026 at 7:04 am
  • Editorial Team
    Editorial Team added an answer IF you looking for a way to do it with… May 16, 2026 at 7:04 am
  • Editorial Team
    Editorial Team added an answer Yes, this will work if you have the permissions. If… May 16, 2026 at 7:04 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.