[Tex/LaTex] Ignoring actual height and width of box

boxes

I would like the following TikZ qtree to come out symmetric:

\documentclass{article}
\usepackage{tikz-qtree}
\begin{document}
\Tree[.O [.N O R ] [.O N \fbox R ] [.R N O ]]
\end{document}

(so that, in particular, the edge from the root to its child 'O' is vertical). Since

\documentclass{article}
\usepackage{tikz-qtree}
\begin{document}
\Tree[.O [.N O R ] [.O N R ] [.R N O ]]
\end{document}

is symmetric, obviously it's the \fbox that's preventing this; so I thought that something like:

\documentclass{article}
\usepackage{tikz-qtree}
\begin{document}
\Tree[.O [.N O R ] [.O N {\smash{\fbox R}\phantom R} ] [.R N O ]]
\end{document}

would work, but it seems actually to be worse. (I think that this doesn't really have anything to do with qtree, which is why I didn't put it in the tags, but I couldn't think up an equivalent example without it.)

(EDIT: Per @DavidCarlisle's advice, I made all code snippets compile-able.)

Best Answer

You can trick TeX to see only a box of the width of the boxed character:

\documentclass{article}
\usepackage{tikz-qtree}
\usepackage{calc}

\begin{document}

\Tree[.O [.N O R ] [.O N \makebox[\widthof{R}][c]{\fbox{R}} ] [.R N O ]]

\end{document}

enter image description here