[Solved] Tabularx alternate row colors not working

24suns Asks: Tabularx alternate row colors not working
I’m unable to get alternate row colors to display for any of my tables inside sections. What am I missing? My MWE for a sample section: main.tex

Code:
documentclass{article}
usepackage[document]{ragged2e}
usepackage[nohead,paperheight=11.0in,paperwidth=8.5in,left=0.5in,right=0.5in,top=0.5in,bottom=1.0in]{geometry}

usepackage{fontspec}
usepackage{datatool}
usepackage{longtable}
usepackage{tabularx}
usepackage{amsmath}

usepackage{hhline}
usepackage{multicol}
usepackage{multirow}
usepackage{booktabs}
usepackage{makecell}
usepackage{color, colortbl}
usepackage[table]{xcolor}

usepackage{etoolbox}
usepackage{array}
usepackage{luacode}
usepackage{xcolor}
usepackage{graphicx}
usepackage[compact]{titlesec}

titleformat{section}
{normalfontLargebfseriesfilcenter}{thesection}{1em}{}
renewcommand{familydefault}{sfdefault}

renewcommand{arraystretch}{1.5}
titlespacing*{section}{0pt}{*0}{*0}
fontmyfont=cmr12 at 16pt


begin{document}
centering
normalfontLargebfseriesfilcenter{HEADER\ }

input{graticule}

end{document}

graticule.tex

Code:
section*{}
newcolumntype{L}{|>{raggedrightarraybackslashbfseries}X|X}
catcode10=9

definecolor{tableShade}{gray}{0.9}

begin{luacode*}
local json = require("json")
local file = io.open("data.json")
tab = json.parse(file:read("*all"))
file:close()


tex.sprint(
    [[begin{table}[ht!]
    centering
    begin{tabularx}{textwidth}{@{} LL @{}}
    rowcolor{lightgray!50}
    hline]])
    for k, v in ipairs(tab["Graticule"]["Header"]) do
        tex.sprint(
        [[textbf]],
        v.key, [[& ]],
        v.val, [[\]],
        [[hhline{--}]])
    end  
tex.sprint(
    [[hhline{--}
    end{tabularx}
    end{table}]])

end{luacode*}

data.json

Code:
{
    "Graticule": {
        "title":"ZONE 29",
        "Header": [
            {
                "key": "A",
                "val": "a"
            },
            {
                "key": "C",
                "val": "d"
            },
            {
                "key": "D",
                "val": "e"
            },
            {
                "key": "F",
                "val": "f"
            },
            {
                "key": "G",
                "val": "h"
            }
        ]
    }
}

and json.lua file that parses the JSON is from Jeffrey Friedl’s Blog » Simple JSON Encode/Decode in Pure Lua

this is the result:
enter image description here

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.