This is part of a larger problem, but I seem to be stuck at the trivial(ish) stage.
I want to centre a coffin containing a picture relative to the paper. I hoped to do this using the coffins poles, but I can't seem to make that work. I can do it if I know the width of the picture, so I could, if necessary, check the width and then use the result. However, I'm wondering if there is a simpler approach which would not require that.
Note that this example necessarily produces bad boxes, as must any satisfactory answer.
\begin{filecontents}{pic.tex}
\documentclass{standalone}
\begin{document}
\begin{tikzpicture}
\shade [left color=Cerulean, right color=Cerulean, middle color=MidnightBlue] (0,0) rectangle (200mm,10mm);
\end{tikzpicture}
\end{document}
\end{filecontents}
\documentclass[a4paper,x11names,svgnames,dvipsnames]{article}
\usepackage{geometry,standalone,tikz,xcoffins,calc}
\begin{document}
\NewCoffin\TestCoffin
\SetHorizontalCoffin\TestCoffin{\input{pic}}
This works:\par
\noindent
\TypesetCoffin\TestCoffin[l,vc](-100mm+.5\textwidth,0pt)
\bigskip
This doesn't:\par
{\centering
\TypesetCoffin\TestCoffin[hc,vc]\par}
\bigskip
Can I centre the coffin \emph{without} knowing the width of the picture?
\end{document}
I expected that, if I was at the centre of the page, using hc would centre the coffin. Since the margins are equal by default in a one-sided article, I expected this to set the picture centrally on the paper, too.
That is, I expected to get the same result from both code samples above. But not only do I not get that, I don't actually have any idea what I get instead. \TypesetCoffin doesn't ignore the \centering and it does not ignore the hc, either, but I'm not at all clear what exactly it does with them. (Or if it is \TypesetCoffin's doing at all.)
What do I not understand?




\llap) or insert negative glue before it, cf. this example. – Henri Menke Jun 12 '17 at 00:29hcand it is\centering, why does it end up like that? Your point would explain a shift to the right, but not the left. – cfr Jun 12 '17 at 00:49hvpole, the width of the coffin is reduced to half the width with the left part sticking out. So the right half of the coffin is centred. – Henri Menke Jun 12 '17 at 01:00\centeringmust do. I can't use TikZ as I'd be nestingtikzpictures. – cfr Jun 12 '17 at 01:13