I would like to determine how many characters of the verbatim font that fits on a text line. Consider:


This gives me the following screenshot:

enter image description here

from which I can infer that there are approximately 73 characters on a line. How can I determine this number programmatically from within LaTeX?


Compute the number by dividing the text width by the width of one character:

  Lines contain
   \divide\count255 by\dimen0
   characters in \texttt{\string#1}}




enter image description here

| improve this answer | |
  • rounded or truncated ;-) – Marco Daniel May 10 '13 at 19:22
  • @MarcoDaniel Truncated: we want to see how many really fit. ;-) – egreg May 10 '13 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.