Skip to content

Commit 5228c8e

Browse files
committed
add extra examples/tests (from branch 7-tables)
1 parent da74bb3 commit 5228c8e

File tree

6 files changed

+322
-0
lines changed

6 files changed

+322
-0
lines changed

29-a11y-table/tabularBasic.tex

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
\documentclass{ximera}
2+
\title{Tabular and array}
3+
4+
\begin{document}
5+
\begin{abstract}
6+
\end{abstract}
7+
\maketitle
8+
9+
\section{Basic Usage}
10+
11+
12+
With \verb|tabular| (and \verb|center|):
13+
\begin{center}
14+
\begin{tabular}{lr}
15+
x & 1 \\
16+
y & 2 \\
17+
z & 1
18+
\end{tabular}
19+
\end{center}
20+
21+
With \verb|tabular and @{} | (and \verb|center|):
22+
\begin{center}
23+
\begin{tabular}{@{}l@{ }r@{.}}
24+
x & 1 \\
25+
y & 2 \\
26+
z & 1
27+
\end{tabular}
28+
\end{center}
29+
30+
With \verb|tabular and p{} | (and \verb|center|):
31+
\begin{center}
32+
\begin{tabular}{|p{1cm}|p{2cm}|p{3cm}|}
33+
x & 1 & 2\\
34+
y & 2 & 3\\
35+
z & 1 & 4
36+
\end{tabular}
37+
\end{center}
38+
39+
With \verb|array|:
40+
$$
41+
\begin{array}{l|r}
42+
x & 1 \\
43+
\hline
44+
y & 2 \\
45+
z & 1
46+
\end{array}
47+
$$
48+
With \verb|array and @{} and p{}|:
49+
$$
50+
\begin{array}{@{X }l@{|}p{2cm}|}
51+
x & 1 \\
52+
\hline
53+
y & 2 \\
54+
z & 1
55+
\end{array}
56+
$$
57+
58+
\end{document}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
\documentclass{article}
2+
\title{Tabular and array (with 'article')}
3+
4+
\begin{document}
5+
% \begin{abstract}
6+
% \end{abstract}
7+
\maketitle
8+
9+
\section{Basic Usage}
10+
11+
12+
With \verb|tabular| (and \verb|center|):
13+
\begin{center}
14+
\begin{tabular}{lr}
15+
x & 1 \\
16+
y & 2 \\
17+
z & 1
18+
\end{tabular}
19+
\end{center}
20+
21+
With \verb|tabular and @{} | (and \verb|center|):
22+
\begin{center}
23+
\begin{tabular}{@{}l@{ }r@{.}}
24+
x & 1 \\
25+
y & 2 \\
26+
z & 1
27+
\end{tabular}
28+
\end{center}
29+
30+
With \verb|tabular and p{} | (and \verb|center|):
31+
\begin{center}
32+
\begin{tabular}{|p{1cm}|p{2cm}|p{3cm}|}
33+
x & 1 & 2\\
34+
y & 2 & 3\\
35+
z & 1 & 4
36+
\end{tabular}
37+
\end{center}
38+
39+
With \verb|array|:
40+
$$
41+
\begin{array}{l|r}
42+
x & 1 \\
43+
\hline
44+
y & 2 \\
45+
z & 1
46+
\end{array}
47+
$$
48+
With \verb|array and @{} and p{}|:
49+
$$
50+
\begin{array}{@{X }l@{|}p{2cm}|}
51+
x & 1 \\
52+
\hline
53+
y & 2 \\
54+
z & 1
55+
\end{array}
56+
$$
57+
58+
\end{document}

29-a11y-table/tblrBasic.tex

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
\documentclass{ximera}
2+
3+
\title{Tables: tblr}
4+
5+
\begin{document}
6+
\begin{abstract}
7+
\end{abstract}
8+
9+
\maketitle
10+
11+
\section{Basic Usage}
12+
13+
\subsection{A simple table with colspec lcr, textwidth: }
14+
15+
\begin{center}
16+
\begin{tblr}{
17+
colspec = {lcr},
18+
rowhead=1,
19+
}
20+
%\toprule %% THIS CAUSES COMPILATION TO HANG
21+
%\hline %% THIS CAUSES COMPILATION TO HANG
22+
Left aligned & Centered & Right aligned \\
23+
% \midrule
24+
Some text & More text & Final text \\
25+
Math $x^2$ & \textbf{Bold text} & \textit{Italic text} \\
26+
%\bottomrule
27+
\end{tblr}
28+
\end{center}
29+
30+
\subsection{Another table: }
31+
32+
\begin{center}
33+
\begin{tblr}{
34+
width=\linewidth,
35+
rowhead=1,
36+
colspec = {
37+
X[t,l,wd=3cm] % max 3.cm
38+
Q[t,c] % fixed
39+
X[t,r,wd=3cm] % max 3cm
40+
X[t,l] % stretchable
41+
},
42+
row{1} = {font=\bfseries},
43+
column{2} = {font=\itshape}, % Italic text in 2nd column
44+
rowsep = 6pt,
45+
% hlines, %% THIS CAUSES COMPILATION TO HANG
46+
% vlines, %% THIS CAUSES COMPILATION TO HANG
47+
}
48+
Top aligned, left aligned & Top aligned, centered (italic) & Top aligned, right aligned & Top-left regular \\
49+
\SetCell[r=2]{t,l}Multirow: top-left aligned & \SetCell[r=2]{t,c}Multirow: top-centered (italic) & \SetCell[c=2]{t,l}Multicolumn: top-left aligned over 2 cols & \\
50+
Bottom aligned, left aligned & Center aligned (italic) & Right aligned & Bottom-left regular \\
51+
\end{tblr}
52+
\end{center}
53+
54+
\subsection{One more table:}
55+
56+
\begin{center}
57+
\begin{tblr}{
58+
colspec = {Q[l] Q[c] Q[r] Q[l]}, % Q = flexible column, with alignment
59+
rowhead = 1,
60+
row{1} = {font=\bfseries}, % make header bold
61+
column{2} = {font=\itshape}, % italicize second column
62+
column{3} = {halign=center}, % center-align 3rd column
63+
rowsep = 4pt,
64+
% hlines,
65+
% vlines,
66+
}
67+
Name & Role & Age & Remarks \\
68+
Alice & Developer & 30 & Works remotely \\
69+
Bob & Designer & 27 & \SetCell[r=2]{c}On leave \\
70+
Charlie & \SetCell[c=2]{l}Intern (UI + UX) & & \\
71+
Diana & Project Manager & 34 & Full time \\
72+
\end{tblr}
73+
\end{center}
74+
75+
\subsection{A simple table with colspec X: }
76+
77+
\begin{tblr}{
78+
colspec = {X[l]X[c]X[r]},
79+
% rowhead=1,
80+
% width = \textwidth
81+
}
82+
%\toprule %% THIS CAUSES COMPILATION TO HANG
83+
%\hline %% THIS CAUSES COMPILATION TO HANG
84+
Left aligned & Centered & Right aligned \\
85+
% \midrule
86+
Some text & More text & Final text \\
87+
%\bottomrule
88+
\end{tblr}
89+
90+
91+
\end{document}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
\documentclass{article}
2+
\usepackage{xcolor}
3+
\usepackage{tabularray}
4+
\UseTblrLibrary{booktabs} % Optional, for \toprule etc.
5+
6+
\title{Tables: tblr (with 'article')}
7+
8+
\begin{document}
9+
10+
\maketitle
11+
12+
\section{Basic Usage}
13+
14+
\subsection{A simple table with colspec lcr, textwidth: }
15+
16+
\begin{center}
17+
\begin{tblr}{
18+
colspec = {lcr},
19+
rowhead=1,
20+
}
21+
%\toprule %% THIS CAUSES COMPILATION TO HANG
22+
%\hline %% THIS CAUSES COMPILATION TO HANG
23+
Left aligned & Centered & Right aligned \\
24+
% \midrule
25+
Some text & More text & Final text \\
26+
Math $x^2$ & \textbf{Bold text} & \textit{Italic text} \\
27+
%\bottomrule
28+
\end{tblr}
29+
\end{center}
30+
31+
\subsection{Another table: }
32+
33+
\begin{center}
34+
\begin{tblr}{
35+
width=\linewidth,
36+
rowhead=1,
37+
colspec = {
38+
X[t,l,wd=3cm] % max 3.cm
39+
Q[t,c] % fixed
40+
X[t,r,wd=3cm] % max 3cm
41+
X[t,l] % stretchable
42+
},
43+
row{1} = {font=\bfseries},
44+
column{2} = {font=\itshape}, % Italic text in 2nd column
45+
rowsep = 6pt,
46+
% hlines, %% THIS CAUSES COMPILATION TO HANG
47+
% vlines, %% THIS CAUSES COMPILATION TO HANG
48+
}
49+
Top aligned, left aligned & Top aligned, centered (italic) & Top aligned, right aligned & Top-left regular \\
50+
\SetCell[r=2]{t,l}Multirow: top-left aligned & \SetCell[r=2]{t,c}Multirow: top-centered (italic) & \SetCell[c=2]{t,l}Multicolumn: top-left aligned over 2 cols & \\
51+
Bottom aligned, left aligned & Center aligned (italic) & Right aligned & Bottom-left regular \\
52+
\end{tblr}
53+
\end{center}
54+
55+
\subsection{One more table:}
56+
57+
\begin{center}
58+
\begin{tblr}{
59+
colspec = {Q[l] Q[c] Q[r] Q[l]}, % Q = flexible column, with alignment
60+
rowhead = 1,
61+
row{1} = {font=\bfseries}, % make header bold
62+
column{2} = {font=\itshape}, % italicize second column
63+
column{3} = {halign=center}, % center-align 3rd column
64+
rowsep = 4pt,
65+
% hlines,
66+
% vlines,
67+
}
68+
Name & Role & Age & Remarks \\
69+
Alice & Developer & 30 & Works remotely \\
70+
Bob & Designer & 27 & \SetCell[r=2]{c}On leave \\
71+
Charlie & \SetCell[c=2]{l}Intern (UI + UX) & & \\
72+
Diana & Project Manager & 34 & Full time \\
73+
\end{tblr}
74+
\end{center}
75+
76+
\subsection{A simple table with colspec X:}
77+
78+
\begin{tblr}{
79+
colspec = {X[l]X[c]X[r]},
80+
% rowhead=1,
81+
% width = \textwidth
82+
}
83+
%\toprule %% THIS CAUSES COMPILATION TO HANG
84+
%\hline %% THIS CAUSES COMPILATION TO HANG
85+
Left aligned & Centered & Right aligned \\
86+
% \midrule
87+
Some text & More text & Final text \\
88+
%\bottomrule
89+
\end{tblr}
90+
91+
92+
\end{document}

29-a11y-table/xmPreamble.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
\usepackage{tabularray}
2+
\UseTblrLibrary{booktabs} % Optional, for \toprule etc.
3+
24
%% must load tabularray first
35
\usepackage{TailorSwiftBotPublic}
46

29-a11y-table/xourse..tex

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
\documentclass{xourse}
2+
\UseTblrLibrary{booktabs} % Optional, for \toprule etc.
3+
4+
\title{Test: Tables}
5+
6+
\begin{document}
7+
\maketitle
8+
9+
\activity{./tabularBasic}
10+
\begin{onlineOnly}
11+
\activity{./tabularBasic_article}
12+
\end{onlineOnly}
13+
% \begin{onlineOnly}
14+
% \activity{../table/tableBase_css} %% DOES NOT WORK: only xourse-level .css files
15+
% \end{onlineOnly}
16+
\activity{./tblrBasic}
17+
\ifonline
18+
\activity{./tblrBasic_article}
19+
\fi
20+
21+
\end{document}

0 commit comments

Comments
 (0)