# Replace paragraphs with boxes [closed]

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.

## closed as unclear what you're asking by Mensch, Thorsten, Stefan Kottwitz♦Oct 10 '13 at 15:48

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• 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 – David Carlisle Aug 20 '13 at 14:34