I have something like this:
\documentclass[]{article}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{listings}
\usepackage{xcolor}
\definecolor{corH}{HTML}{7030A0}
\definecolor{corE}{HTML}{FFC000}
\definecolor{corL}{HTML}{007523}
\lstdefinelanguage{StrucCompOut}{
literate=
{@}{{\colorbox{corH!20}{\makebox[1pt]{\strut\textcolor{corH}{H}}}}}1
{\$}{{\colorbox{corH!10}{\makebox[1pt]{\strut\textcolor{corH!80}{h}}}}}1
{?}{{\colorbox{corE!20}{\makebox[1pt]{\strut\textcolor{corE}{E}}}}}1
{\&}{{\colorbox{corE!10}{\makebox[1pt]{\strut\textcolor{corE!80}{e}}}}}1
{+}{{\colorbox{corL!20}{\makebox[1pt]{\strut\textcolor{corL}{L}}}}}1
{*}{{\colorbox{corL!10}{\makebox[1pt]{\strut\textcolor{corL!80}{l}}}}}1,
sensitive=true,
numbers=none,
breaklines=true,
lineskip=0pt,
basicstyle=\ttfamily,
keepspaces=true
}
\lstset{
language=StrucCompOut
}
\newcommand{\alnData}[1]{\lstinline[columns=fixed]$#1$}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ccc}
\toprule
\textbf{A} & \textbf{B} & \textbf{C} \\
\midrule
\multirow{2}[1]{*}{AAA} & \alnData{\$\$\$@@@???\&\&?******} & \multirow{2}[1]{*}{AAA} \\
& \alnData{aaaBBBCCCddCffffff} & \\
& \alnData{ ||| | | } & \\
\multirow{2}[1]{*}{BBB} & \alnData{BBBBBBddCddCEEEEEE} & \multirow{2}[1]{*}{BBB} \\
& \alnData{@@@@@@\&\&?\&\&?++++++} & \\
\bottomrule
\end{tabular}%
\end{table}
\end{document}
That is redering this:
But in my middle line with pipe chars I need to keep the spaces, i.e., I need something like this:
I already tried a lot of parameters and hacks that I read here, but I'm not able to make it work. I need to keep the spaces because the pipes must be aligned with my data. All the data will be inside a table and I have a lot of row sets with data similar of that. I think that inserting a space for literate would work, but I can't figure out how to do this.