TeX - LaTeX Asked on April 19, 2021
In this example I would like a continuous display for box characters which is not yet the case:
documentclass{article}
usepackage{fontspec}
usepackage{dejavu}
setmonofont{DejaVu Sans Mono}
renewcommand{baselinestretch}{0.1}
begin{document}
begin{verbatim}
┞─┬─┬─┬─┬─┬─┬─┬─┦
│0│1│0│1│0│0│1│1│
└─┴─┴─┴─┴─┴─┴─┴─┘
end{verbatim}
end{document}
With the current code I get this:
In my text editor it’s fine:
I think the row space is the minimum vertical spaces inserted between vbox
es. It is controlled by lineskip
and has initial value 1pt
. In the following example I set lineskip
to zero inside every verbatim
environment and it seems to work.
documentclass{article}
usepackage{etoolbox}
usepackage{fontspec}
usepackage{dejavu}
setmonofont{DejaVu Sans Mono}
AtBeginEnvironment{verbatim}{setlength{lineskip}{0pt}}
begin{document}
begin{verbatim}
┞─┬─┬─┬─┬─┬─┬─┬─┦
│0│1│0│1│0│0│1│1│
└─┴─┴─┴─┴─┴─┴─┴─┘
end{verbatim}
end{document}
Correct answer by muzimuzhi Z on April 19, 2021
As muzimuzhi Z says, the problem is lineskip
, whose default value is 1pt. Since the lines would touch each other, TeX inserts lineskip
glue.
However, there are other problems with your code: blank spaces are preserved at the beginning of lines, so your verbatim
environment is indented.
In my opinion, one should never indent the contents of a verbatim
environment. If an indent is wanted, it's better to use fancyvrb
features; among them there is the possibility of gobbling initial spaces, but I don't recommend it.
You can also say fvsetup{formatcom=setlength{lineskip}{0pt}}
in the preamble, if you want this setting to hold in every Verbatim
environment (note the uppercase initial).
documentclass{article}
usepackage{fontspec}
usepackage{fancyvrb}
setmonofont{DejaVu Sans Mono}
begin{document}
begin{Verbatim}[formatcom=setlength{lineskip}{0pt}]
┞─┬─┬─┬─┬─┬─┬─┬─┦
│0│1│0│1│0│0│1│1│
└─┴─┴─┴─┴─┴─┴─┴─┘
end{Verbatim}
begin{Verbatim}[formatcom=setlength{lineskip}{0pt}]
┞─┬─┬─┬─┬─┬─┬─┬─┦
│0│1│0│1│0│0│1│1│
└─┴─┴─┴─┴─┴─┴─┴─┘
end{Verbatim}
begin{Verbatim}[formatcom=setlength{lineskip}{0pt},gobble=4]
┞─┬─┬─┬─┬─┬─┬─┬─┦
│0│1│0│1│0│0│1│1│
└─┴─┴─┴─┴─┴─┴─┴─┘
end{Verbatim}
begin{Verbatim}[formatcom=setlength{lineskip}{0pt},gobble=4,xleftmargin=parindent]
┞─┬─┬─┬─┬─┬─┬─┬─┦
│0│1│0│1│0│0│1│1│
└─┴─┴─┴─┴─┴─┴─┴─┘
end{Verbatim}
end{document}
Answered by egreg on April 19, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP