1

I am back with my table.

I edited it to use macros and it works very well. Now I was trying to print a single page twice on a recto-verso page. I ended up having 2 tables on 2 pages instead of 2 tables on 1 pages. I figured I can not do that and I should repeat my table to accommodate the printer.

So I used a macro to repeat the table and it works. But I wonder if there is a better way of doing that?

In case you are wondering, here is the code in my tex file:

    \documentclass{letter}

    \usepackage[a4paper, landscape, margin=0.5cm]{geometry}
    \usepackage{multirow}
    \usepackage{tabularx}
    \usepackage{graphicx}

    \setlength{\extrarowheight}{14pt}

    \newcommand\customTable{
            \begin{tabularx}{\textwidth}{cc|c|X|c|X|c|X|c|X|c|X|c|X|c|X|c|X|c|X|c|X|c|c|}
                    \cline{3-22}

                    & & \multicolumn{20}{ c| }{\LARGE Joueurs} \\ \cline{3-22}

                    & & \multicolumn{4}{ c| }{} & \multicolumn{4}{ c| }{} & \multicolumn{4}{ c| }{} & \multicolumn{4}{ c| }{} & \multicolumn{4}{ c| }{} \\ \cline{1-24}

                    \customRow{10}{\multirow{20}{*}{\rotatebox[origin=c]{90}{\LARGE Cartes}}}\cline{2-24}
                    \customRow{9}{}\cline{2-24}
                    \customRow{8}{}\cline{2-24}
                    \customRow{7}{}\cline{2-24}
                    \customRow{6}{}\cline{2-24}
                    \customRow{5}{}\cline{2-24}
                    \customRow{4}{}\cline{2-24}
                    \customRow{3}{}\cline{2-24}
                    \customRow{2}{}\cline{2-24}
                    \customRow{1}{}\cline{1-22}
            \end{tabularx}
    }
    \newcommand\customHeader[2]{
            \multicolumn{1}{|c}{#2} &
            \multicolumn{1}{|c|}{\multirow{2}{*}{\LARGE #1}}
    }
    \newcommand\emptyCells{
            & ~~~ & & ~~~ & & ~~~ & & ~~~ & & ~~~ & & ~~~ & & ~~~ & & ~~~ & & ~~~ & & ~~~ & & ~~~ & ~~~ \\
    }
    \newcommand\customBorder{
            \cline{3-3} \cline{5-5} \cline{7-7} \cline{9-9} \cline{11-11} \cline{13-13} \cline{15-15} \cline{17-17} \cline{19-19} \cline{21-21} \cline{23-24}
    }
    \newcommand\emptyDoubleCells{
            \multicolumn{1}{|c}{} & \multicolumn{1}{|c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} \\
    }
    \newcommand\customRow[2]{
            \customHeader{#1}{#2}\emptyCells\customBorder\emptyDoubleCells
    }


    \begin{document}
            \pagenumbering{gobble}
            \customTable
            \customTable
    \end{document}
A.D.
  • 285
  • Can't you put it into a separate file and read the file via input? – Dr. Manuel Kuehner May 20 '17 at 08:22
  • \savebox \usebox is pretty efficient. – John Kormylo May 20 '17 at 13:04
  • @Dr.ManuelKuehner But is it a better approach compared to what I did? – A.D. May 20 '17 at 14:42
  • @JohnKormylo But is it a better approach compared to what I did? – A.D. May 20 '17 at 14:43
  • You decide. I think that it is less likely to cause side effects, e. g. if you use special stuff like verbatim text (see https://tex.stackexchange.com/questions/272850). And in my opinion, the code is tidier. – Dr. Manuel Kuehner May 20 '17 at 15:14
  • But if a high rep user like @JohnKormylo suggests something (\savebox \usebox) then it's usual a good idea to take a look ;). – Dr. Manuel Kuehner May 20 '17 at 15:55
  • It sort of depends on what you want to put into all those empty cells, and whether they are all the same size. Tabular isn't the only way to arrange things into arrays. See https://tex.stackexchange.com/questions/168281/how-to-draw-a-chessboard-with-numbers/168304?s=1|4.0370#168304 and https://tex.stackexchange.com/questions/176280/image-link-clickable-in-non-white-areas-excluding-the-background/261071?s=1|0.2126#261071 – John Kormylo May 20 '17 at 19:39
  • Actually, I am pretty satisfied with the table. Cells are empty on purpose. My question was more on the table duplication. But I keep in mind the links you provided. – A.D. May 20 '17 at 20:48

0 Answers0