# [#6609] Allow non-standard alignments in align string

Date:
2019-01-01 09:41
Priority:
3
State:
Open
Submitted by:
Hugh Parsonage (hughparsonage)
Assigned to:
Nobody (None)
Product:
None
Operating System:
None
Component:
None
Summary:
Allow non-standard alignments in align string

Detailed description
In the below document, xtable emits a warning Nonstandard alignments in align string. However, the align arguments are correct, in context.

\documentclass{article}
\usepackage{tabularx}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}

\begin{document}

<<a-tablularx, results='asis'>>=
library(xtable)
xtable(data.frame(x = "a", y = 1, z = 2), align = "lXRR")
@

\end{document}

I would like to propose a new package option xtable.alignAllowedExtra together with a single line of code change, viz. line 76 in R/table.attributes.R from

alignAllowed <- c("l","r","p","c","|","X")

to

alignAllowed <- c("l","r","p","c","|","X", getOption("xtable.alignAllowedExtra"))

So that users can set, for example,

options("xtable.alignAllowedExtra" = "R")

in their preamble to allow any new column types to be set without emitting a warning. This change would be backwards-compatible.

Currently, to avoid the warning I have to surround each xtable call with suppressWarnings (which is inconvenient and risks suppressing other warnings) or use assignInNamespace (which is prohibited in package code).

Thank you for a fantastic package!