I found a hint from Karl Berry written 4 years ago about how to get line wrapping in code samples, in texi2pdf
output. I demonstrate that solution below. However, it would be interesting to know if there is a way to do this without requiring hand-tuning of the expressions that are being printed.
One possible work-around that occurred to me is to do the hand-tweaking as needed and wrap that in @ifpdf
tags. But that seems to be explicitly not possible.
At present, Texinfo does not provide ‘@ifpdf’ or ‘@pdf’ commands as for the other output formats, since PDF documents contain many internal low-level offsets and references that would be hard or impossible to get right at the Texinfo source level.
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename longline.info
@settitle Long Line Sample
@c %**end of header
@node Top
@chapter Long line example
Here is an example of a code block, it is formatted using a pair of matching @code{@@example} and @code{@@end example} tags.
@example
(["lessfrequentword" java.lang.string]
["mostfrequentword" java.lang.string]
["wordstupleswithfrequency"
#<parameterizedtypeimpl java.util.arraylist<java.lang.string[]>>]
["words" #<parameterizedtypeimpl
java.util.arraylist<ccg.flow.processnodes.text.retrievers.dictionary.dictionaryitem>>])
@end example
As you can see, there is no linewrapping. What I would like is something that looks more like this:
@quotation
@t{(["lessfrequentword" java.lang.string]}@*
@t{["mostfrequentword" java.lang.string]}@*
@t{["wordstupleswithfrequency"}@*
@t{#<parameterizedtypeimpl java.util.arraylist<java.lang.string[]>>]}@*
@t{["words" #<parameterizedtypeimpl}@*
@t{ java.util.arraylist<ccg.flow.processnodes.text.retrievers.dictionary. dictionaryitem>>])}@*
@end quotation
But ideally without the need to hand-tweak the text (note extra space introduced in the
second listing in particular).
@bye