Fix table newpages
This commit is contained in:
parent
2cb332339e
commit
86e2c54a9f
|
@ -1,5 +1,10 @@
|
|||
/**
|
||||
* Turns an array of kanji into a tabular for a chapter overview
|
||||
* @param {string[]} kanjiArray A list of kanji to put into the table
|
||||
* @returns {string} A tex tabular.
|
||||
*/
|
||||
function kanjiTable(kanjiArray) {
|
||||
const xLength = 15;
|
||||
const xLength = 16;
|
||||
const yLength = Math.ceil(kanjiArray.length/xLength);
|
||||
const sideLength = Math.ceil(Math.sqrt(kanjiArray.length));
|
||||
|
||||
|
@ -8,6 +13,8 @@ function kanjiTable(kanjiArray) {
|
|||
|
||||
const lineArray = new Array;
|
||||
|
||||
lineArray.push(`{\\large ${y_index*16}}`);
|
||||
|
||||
for (let x_index = 0; x_index < xLength; x_index++) {
|
||||
const indexNumber = y_index * xLength + x_index;
|
||||
lineArray.push(kanjiArray[indexNumber] ? kanjiArray[indexNumber] : '');
|
||||
|
@ -16,8 +23,8 @@ function kanjiTable(kanjiArray) {
|
|||
tableString += `${lineArray.join(' & ')} \\\\\n`
|
||||
}
|
||||
|
||||
return `\\begin{tabular}{ ${'c '.repeat(xLength)}}
|
||||
${tableString}\\end{tabular}`
|
||||
return `\\begin{longtable}{ ${'c '.repeat(xLength+1)}}
|
||||
${tableString}\\end{longtable}`
|
||||
}
|
||||
|
||||
exports.kanjiTable = kanjiTable;
|
|
@ -12,9 +12,10 @@
|
|||
\newcommand{\jlptSection}[1]{
|
||||
\section*{\uppercase{#1}}
|
||||
|
||||
\resizebox{\textwidth}{!}{
|
||||
\begin{center}
|
||||
\fontsize{16}{16}
|
||||
\input{./data/tables/#1.tex}
|
||||
}
|
||||
\end{center}
|
||||
|
||||
\localtableofcontents
|
||||
|
||||
|
|
Loading…
Reference in New Issue