1

I get this error, although I'm not able to find the correspondent LaTeX character to declare.

! Package inputenc Error: Unicode char ▁ (U+2581)
(inputenc)                not set up for use with LaTeX.
1

1 Answer 1

4

In most font I saw, the full block is a square one em wide so positioned as it has the same height above the cap height as its depth. The character U+2581 is the lowest eighth part of it.

\documentclass{article}
\usepackage[utf8]{inputenc}

\newcommand{\block}[1]{%
  \raisebox{\dimexpr(\fontcharht\font`X-1em)/2}{\rule{1em}{#1\dimexpr1em/8}}%
}
\DeclareUnicodeCharacter{2581}{\block{1}}
\DeclareUnicodeCharacter{2582}{\block{2}}
\DeclareUnicodeCharacter{2583}{\block{3}}
\DeclareUnicodeCharacter{2584}{\block{4}}
\DeclareUnicodeCharacter{2585}{\block{5}}
\DeclareUnicodeCharacter{2586}{\block{6}}
\DeclareUnicodeCharacter{2587}{\block{7}}
\DeclareUnicodeCharacter{2588}{\block{8}}

\begin{document}

A▁A▂A▃A▄A▅A▆A▇A█

\end{document}

enter image description here

1
  • Also changing the LaTeX engine to xelatex did it, thanks!
    – Sinval
    Apr 29, 2018 at 18:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .