When grid layouts contain units with many decimal places they aren't easy to read. This example is adapted from the one in example(grid.show.layout).
h <- unit(rep(14/13, 4), c("lines", "lines", "lines", "null"))
w <- unit(c(6/7, 10/11), "inches")
grid.show.layout(grid.layout(4,2, heights=h, widths=w))
Displaying many decimal places is unlikely to be beneficial in most cases, so limiting to 3 or 4 signficant figures seems sensible.
Here is my suggested fix.
Firstly, define a format method for units.
format.unit <- function(x, ...)
class(x) <- NULL
paste0(format(x, ...), attr(x, "unit"))
Secondly, in grid.show.layout, replace calls to as.character.unit with format.unit. For example, the line:
grid.text(as.character(l$heights[i, top = FALSE])
grid.text(format(l$heights[i, top = FALSE], digits = 4)
I don't know if you want to have the number of digits fixed or let it be passed as an argument to grid.show.layout.
A format.unit() sounds reasonable, though it will have to be a bit more sophisticated than the suggestion. For example ...
> format(unit(1, "npc") - unit(1, "mm"))
 "-" "1" "1"
Will put this on my TODO list
A format() method for units has been added to r-devel (r71444) and grid.show.layout() uses format() instead of as.character()