# How to box every char of a long string within a visual grid

🖖 a newbie here ;)

I'm trying to create a box around every character of a super long string (eg. let's say something like all the unicode chars) loaded from an external file (inputlisting probably?).

I need the boxes to be 1em ✕ 1em to be visually appealing, or any fixed defined size.

I don't know the number of columns that fit into the linewidth and I expect to find a solution that handles breaklines and on multiple pages.

The result should be something like this:

In your opinion is tabular the way to go (eg. this) or something like this to loop over strings?

I feel like ltxtable and other stuff I found reading here and there are the way to go, but there are really dozens packages to handle tables, and I'm not able to find where to start from.

PS. No problem on go with solutions like luatex and similar as long as it works ;)

A simple loop with \frameboxes should do. Run with LuaLaTeX (XeLaTeX should also work).

\documentclass{article}
\begin{document}

\newcount\curchar
\noindent
\loop\ifnum\curchar<"10000
\iffontchar\font\curchar
\framebox[5ex]{%
\vrule height 2.5ex depth 1.5ex width 0pt\relax
\Uchar\curchar
}\hskip0pt
\fi

• Super, thanks, I'm trying to understand your commands. I was able to reproduce it locally. So it's a loop over the variable curchar that holds the current character that is a number (the first 10000) and is then printed with the \Uchar command, right? Then how to pass an argument of my own string to loop those characters? Another thing I'm also trying to remove the margin... without success :( following this options joshua.smcvt.edu/latex2e/_005cfbox-_0026-_005cframebox.html – pna Apr 13 '20 at 10:30