4

In contexts outside of LaTeX, I've found rectangles of increasing size very useful. I can enter these in UTF-8 in my text editor, but despite trying every font related fix I can find, I can't seem to get these glyphs to show up (I'm using xelatex). Can anyone provide a MWE in which these will appear?

  • ' ' U+2002 En Space Nut
  • '▁' U+2581 lower 1/8
  • '▂' U+2582 lower 1/4
  • '▃' U+2583 lower 3/8
  • '▄' U+2584 lower 1/2
  • '▅' U+2585 lower 5/8
  • '▆' U+2586 lower 3/4
  • '▇' U+2587 lower 7/8
  • '█' U+2588 full block

I can get the ding symbols for horizontally increasing rectangles working ( \ding{120} ❘, \ding{121} ❙, and \ding{122} ❚ ), but I really want vertically increasing blocks.

  • 1
    Are you sure that the font you use contains those characters? Which one are you using? It works here with DejaVu. – Marco Oct 12 '13 at 21:45
  • I would guess that the font I'm using doesn't have those characters, but this is why I'm asking--they don't show up in the document I'm compiling, and I've tried several fonts now. The problem is that I'm new enough to latex that I don't know if I'm just missing something or if I keep choosing 'incomplete' fonts. Is there a list of fonts somewhere of those that would typically support a full set of unicode characters? Thanks! – bwv549 Oct 13 '13 at 6:30
  • 2
    I assume the font doesn't have the glyphs. Did you try DejaVu? There is no font covering the entire Unicode range. Arial Unicode MS and Everson Mono have quite good coverage, though. To inspect the glyphs of the font use your favourite font viever (e.g. fontforge) or have a look at the anwers to Generating a table of glyphs with XeTeX. – Marco Oct 13 '13 at 10:35
  • …and since you're dealing with fonts I highly recommend using LuaTeX or XeTeX. – Marco Oct 13 '13 at 10:36
6

Package pmboxdraw defines box drawing characters using rules:

\documentclass{article}
\usepackage{pmboxdraw}
\begin{document}
\renewcommand*{\arraystretch}{1.2}
\begin{tabular}{lll}
  U+2581 & \pmboxdrawuni{2581} & \verb|\pmboxdrawuni{2581}|\\
  U+2582 & \pmboxdrawuni{2582} & \verb|\pmboxdrawuni{2582}|\\
  U+2583 & \pmboxdrawuni{2583} & \verb|\pmboxdrawuni{2583}|\\
  U+2584 & \textdnblock        & \verb|\textdnblock|\\
  U+2585 & \pmboxdrawuni{2585} & \verb|\pmboxdrawuni{2585}|\\
  U+2586 & \pmboxdrawuni{2586} & \verb|\pmboxdrawuni{2586}|\\
  U+2587 & \pmboxdrawuni{2587} & \verb|\pmboxdrawuni{2587}|\\
  U+2588 & \textblock          & \verb|\textblock|\\
\end{tabular}
\end{document}

Result

Remarks:

  • \usepackage[utf8]{inputenc} is already supported by package pmboxdraw. Thus the symbols can be input as Unicode characters.

  • With XeTeX (or LuaTeX), you can make the Unicode input characters active, e.g.:

    \catcode`\^^^^2581=\active
    \def^^^^2581{\pmboxdrawuni{2581}}
    

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.