Skip to content

Commit

Permalink
common: tableTwoDimensionalArray: New file
Browse files Browse the repository at this point in the history
* src/common/tableTwoDimensionalArray.tex: New file.  Move the common code for
the table here.
* src/ru/sparc.tex, src/en/sparc.tex: Include it.
* src/en/sections/music-and-technology-synthesis-two-dimensional-arrays.tex,
src/ru/sections/music-and-technology-synthesis-two-dimensional-arrays.tex: Use
it.
* Makefile.am (COMMON): Register it.
  • Loading branch information
artyom-poptsov committed Jan 22, 2025
1 parent 4ca6651 commit 444e613
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 47 deletions.
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ COMMON = \
src/common/figureMusicSixBarsFourFour.tex \
src/common/figureMusicBarFourFour.tex \
src/common/figureMusicBarFourFourWithFrequencies.tex \
src/common/figureMusicWeWillRockYouSimplified.tex
src/common/figureMusicWeWillRockYouSimplified.tex \
src/common/tableTwoDimensionalArray.tex

COMMIT = $(shell git rev-parse HEAD)

Expand Down
56 changes: 56 additions & 0 deletions src/common/tableTwoDimensionalArray.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
\newcommand{\tableTwoDimensionalArray}[1]{
\def\lang{\detokenize{#1}}
\def\langRu{\detokenize{ru}}
\def\langEn{\detokenize{en}}
\def\tableFirstColumn{XXX: No translation.}
\def\tableSecondColumn{XXX: No translation.}
\def\tableCaption{XXX: No translation.}
\ifx \lang\langRu
\def\tableFirstColumn{
№ строки
}
\def\tableSecondColumn{
№ столбца
}
\def\tableCaption{
Графическое отображение двумерного массива.
}
\fi
\ifx \lang\langEn
\def\tableFirstColumn{
Row number
}
\def\tableSecondColumn{
Column number
}
\def\tableCaption{
Graphical representation of a two-dimensional array.
}
\fi
\begin{table}[ht]
\centering
\begin{tabular}{r|l|l|l}
\multicolumn{1}{l}{\tableFirstColumn}
& \multicolumn{2}{l}{\tableSecondColumn}
& \\
\multicolumn{1}{l}{} & \multicolumn{1}{l}{0} & \multicolumn{1}{l}{1} & \\
\cline{2-3}
0 & с4 & 4 & \\
\cline{2-3}
1 & с4 & 4 & \\
\cline{2-3}
2 & g4 & 4 & \\
\cline{2-3}
3 & g4 & 4 & \\
\cline{2-3}
4 & a4 & 4 & \\
\cline{2-3}
5 & a4 & 4 & \\
\cline{2-3}
6 & g4 & 2 & \\
\cline{2-3}
\end{tabular}
\caption{\tableCaption}
\label{table:array-example-2}
\end{table}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,7 @@ \subsection{Two-dimensional arrays}
Schematic representation of a two-dimensional array is shown as the table
\ref{table:array-example-2}.

\begin{table}[ht]
\centering
\begin{tabular}{r|l|l|l}
\multicolumn{1}{l}{Row} & \multicolumn{2}{l}{Column} & \\
\multicolumn{1}{l}{} & \multicolumn{1}{l}{0} & \multicolumn{1}{l}{1} & \\
\cline{2-3}
0 & с4 & 4 & \\
\cline{2-3}
1 & с4 & 4 & \\
\cline{2-3}
2 & g4 & 4 & \\
\cline{2-3}
3 & g4 & 4 & \\
\cline{2-3}
4 & a4 & 4 & \\
\cline{2-3}
5 & a4 & 4 & \\
\cline{2-3}
6 & g4 & 2 & \\
\cline{2-3}
\end{tabular}
\label{table:array-example-2}
\end{table}
\tableTwoDimensionalArray{en}

Each row of the array stores a description of one note. The zeroth column holds
the note frequency and the first column holds its length as the fraction
Expand Down
1 change: 1 addition & 0 deletions src/en/sparc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
\input{common/figureMusicBarFourFour.tex}
\input{common/figureMusicBarFourFourWithFrequencies.tex}
\input{common/figureMusicWeWillRockYouSimplified.tex}
\input{common/tableTwoDimensionalArray.tex}

\counterwithin{listing}{section}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,7 @@ \subsection{Двумерные массивы}
Схематическое изображение двумерного массива представлено в виде таблицы
\ref{table:array-example-2}.

\begin{table}[ht]
\centering
\begin{tabular}{r|l|l|l}
\multicolumn{1}{l}{№ строки} & \multicolumn{2}{l}{№ столбца} & \\
\multicolumn{1}{l}{} & \multicolumn{1}{l}{0} & \multicolumn{1}{l}{1} & \\
\cline{2-3}
0 & с4 & 4 & \\
\cline{2-3}
1 & с4 & 4 & \\
\cline{2-3}
2 & g4 & 4 & \\
\cline{2-3}
3 & g4 & 4 & \\
\cline{2-3}
4 & a4 & 4 & \\
\cline{2-3}
5 & a4 & 4 & \\
\cline{2-3}
6 & g4 & 2 & \\
\cline{2-3}
\end{tabular}
\label{table:array-example-2}
\end{table}
\tableTwoDimensionalArray{ru}

Каждая строка нашего массива должна содержать описание одной ноты. Столбец с
номером ноль содержит частоту ноты, а столбец номер один содержит её
Expand Down
1 change: 1 addition & 0 deletions src/ru/sparc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
\input{common/figureMusicBarFourFour.tex}
\input{common/figureMusicBarFourFourWithFrequencies.tex}
\input{common/figureMusicWeWillRockYouSimplified.tex}
\input{common/tableTwoDimensionalArray.tex}

\counterwithin{listing}{section}
\renewcommand\listingscaption{Листинг}
Expand Down

0 comments on commit 444e613

Please sign in to comment.