The MWE below results is spurious space due to the use of \tdplotsetmaincoords
:
The red is the bounding box and the gray box is from \fbox{}
.
Including an \unskip\unskip
(commented out in the MWE) does resolve the problem, but wondering if there is a better solution.
Is this a bug or is there a reason for this spacing?
Notes:
- Moving the
\tdplotsetmaincoords{70}{115}
to be before\begin{document}
also resolves the problem, but this won't easily work for me as my figures use thestandalone
class and are included in other documents -- thus I need to have that setting localized with each figure.
References:
- The code for the cube drawing is from How to draw a cube with TikZ where all faces have a distinct color?.
Code:
\documentclass{article}
\usepackage{tikz,tikz-3dplot}
\newcommand*{\DrawBoundingBox}[1][]{%
\draw [
draw=red, thick,
]
([shift={(-1pt,-1pt)}]current bounding box.south west) rectangle
([shift={(1pt,1pt)}]current bounding box.north east);
}
\begin{document}
\fboxsep=0pt
\fbox{%
%% code from https://tex.stackexchange.com/a/29342/4301
\tdplotsetmaincoords{70}{115}%
%\unskip\unskip% <----- HACK which fixes the problem.
\begin{tikzpicture}[scale=4,tdplot_main_coords]
\coordinate (O) at (0,0,0);
\tdplotsetcoord{P}{1.414213}{54.68636}{45}
\draw[fill=gray!50,fill opacity=0.5] (O) -- (Py) -- (Pyz) -- (Pz) -- cycle;
\draw[fill=blue,fill opacity=0.5] (O) -- (Px) -- (Pxy) -- (Py) -- cycle;
\draw[fill=yellow,fill opacity=0.5] (O) -- (Px) -- (Pxz) -- (Pz) -- cycle;
\draw[fill=green,fill opacity=0.5] (Pz) -- (Pyz) -- (P) -- (Pxz) -- cycle;
\draw[fill=red,fill opacity=0.5] (Px) -- (Pxy) -- (P) -- (Pxz) -- cycle;
\draw[fill=magenta,fill opacity=0.5] (Py) -- (Pxy) -- (P) -- (Pyz) -- cycle;
\DrawBoundingBox
\end{tikzpicture}%
}%
\end{document}
tikz-3dplot
. The last update was in 2012 and there are no contact details of the author in the manual.tikz-3dplot
package. From heinjd.wordpress.com/category/latex, I read in the bottom "Some time ago, I developed the 3dplot package". On heinjd.wordpress.com/about, I read "Jeff recently received a Ph.D. from the University of Manitoba Department of Physics and Astronomy." Finally, I found this JPL page: science.jpl.nasa.gov/people/Hein, with coordinate and CV. Correspond to the informations of thetikz-3dplot
author.