I would like to replace the paragraphs of a compiled document with framed boxes. Although I read the /tex/latex/base documentations I have no idea how to tackle this problem.

In detail I want to implement the following:

  • Given an arbitrary .tex file as input.
  • Output a compiled document where all paragraphs are replaced by framed boxes of their respective sizes and the actual sizes are written to a secondary file.

My questions/uncertainties would be

  1. As this system must not require user interaction to change the .tex input, I cannot rely on additional user commands. Forcing the user to add a command around each paragraph is not possible.
  2. Furthermore, there are no commands around paragraphs that I can substitute with a command redefinition. Thus I cannot use the method that the 'draft' options use.
  3. The box sizes depend on the actual output of the compilation and I am not sure if document classes even have the ability to access this information.
  4. Can someone give me hints on how to start tackling this problem?

Additional questions (which are not so important but related):

  • Can the same be done for every line to output a document where each line is a framed box?
  • In the end I would like to have the following: For an arbitrary .tex file as input I generate another .tex file where all paragraphs are substituted with box commands and the compiled output of both .tex files (when using the paragraph to box method) should look the same.
  • Can you clarify your question a bit, normally framing a block of text would change the layout (to accommodate the frame) do you want here "tight" frames that take up no space (and over-print the text) also paragraphs typically break over a page and/or have partial paragraphs for displayed math. (In general it's not likely to be possible in classic TeX, it may be possible in luatex, depending what the requirements really are Aug 20, 2013 at 14:34


Browse other questions tagged .