Borders of fbox

How can we write words on a border of \fbox in LaTeX like this

Hope image is clear.

• Welcome to TeX-SE! This can be done e.g. with the decorations.text library of TikZ. – user121799 Apr 2 '19 at 2:25

This is to give you a start. There are many ways in which you can adjust things, as explained in section 50.6 Text Decorations of the pgfmanual.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\node[text width=1.9cm,inner sep=3pt] (T) {3/3/30};
\path[decorate,decoration={text along path,
text={|\fontsize{6}{6}\selectfont\sffamily|Something about ducks, marmots,
koalas and groundhogs}}] (T.south west) rectangle (T.north east);
\end{tikzpicture}
\end{document}


Here is another example.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\node[text width=1.75cm,inner sep=3pt] (T) {3/3/30};
\path[decorate,decoration={text along path,
text={|\fontsize{6}{6}\selectfont\sffamily|Something about ducks, marmots,
koalas and groundhogs}}] ([yshift=0.1ex]T.south west) -- ([yshift=-0.1ex]T.north west)
([xshift=-0.3em]T.north west) -- ([xshift=0.3em]T.north east)
([yshift=-0.1ex]T.north east) -- ([yshift=0.1ex]T.south east)
([xshift=0.3em]T.south east) -- ([xshift=-0.3em]T.south west);
\end{tikzpicture}
\end{document}


• Can you modify the code so that the spaces at corners are not there. i.e. no space at corner of "somet" and "hing". Thanks in advance. – user184854 Apr 2 '19 at 6:54
• @user184854 I added an example of that type, – user121799 Apr 2 '19 at 13:02