0

Regarding the command below, it creates a box around the designated letter (B) with colored background (Light gray) and does not affect the inter-character spacing of the word:

\uline{\adjustbox{cframe=black 0.1mm 2pt 0mm,bgcolor=gray!25}{{\textbf{B}}}}ob

I need to have exactly the same result but with a dotted box instead, so I tried the dashbox package, yet I cannot set the dimensions as shown above and also I cannot set the background color, intercharacter spacing, box size and background color cannot be set

\uline{\textbf{\dbox{B}}}ob

\documentclass[a4paper,12pt,twoside]{book}


\usepackage{dashbox}
\usepackage[normalem]{ulem}
\usepackage{adjustbox}

\usepackage[bidi=basic,layout=lists.tabular]{babel}
\babelprovide[import=ar,mapdigits,main]{arabic}
\babelprovide[import=en,language=Default]{english}
\babelfont[arabic]{rm}{Simplified Arabic}
\babelfont[english]{rm}{Times New Roman}

\begin{document}


\uline{\textbf{\dbox{B}}}ob

\uline{\adjustbox{cframe=black 0.1mm 2pt 0mm,bgcolor=gray!25}{{\textbf{B}}}}ob

\end{document}

enter image description here

1 Answer 1

2

A solution using tikz:

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tikz}

\begin{document}

\newcommand{\solidbox}[1]{%
\tikz[baseline]\node[anchor=base, draw=black, outer sep=0pt, inner sep=1pt, fill=black!20] {#1};%
}

\newcommand{\dashedbox}[1]{%
\tikz[baseline]\node[anchor=base, draw=black, dash pattern=on 2pt off 1pt, outer sep=0pt, inner sep=1pt, fill=black!20] {#1};%
}

\noindent ob\solidbox{B}cdef

\noindent ob\dashedbox{B}cdef

\end{document}
1

You must log in to answer this question.

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