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) {
|
function kanjiTable(kanjiArray) {
|
||||||
const xLength = 15;
|
const xLength = 16;
|
||||||
const yLength = Math.ceil(kanjiArray.length/xLength);
|
const yLength = Math.ceil(kanjiArray.length/xLength);
|
||||||
const sideLength = Math.ceil(Math.sqrt(kanjiArray.length));
|
const sideLength = Math.ceil(Math.sqrt(kanjiArray.length));
|
||||||
|
|
||||||
|
@ -8,6 +13,8 @@ function kanjiTable(kanjiArray) {
|
||||||
|
|
||||||
const lineArray = new Array;
|
const lineArray = new Array;
|
||||||
|
|
||||||
|
lineArray.push(`{\\large ${y_index*16}}`);
|
||||||
|
|
||||||
for (let x_index = 0; x_index < xLength; x_index++) {
|
for (let x_index = 0; x_index < xLength; x_index++) {
|
||||||
const indexNumber = y_index * xLength + x_index;
|
const indexNumber = y_index * xLength + x_index;
|
||||||
lineArray.push(kanjiArray[indexNumber] ? kanjiArray[indexNumber] : '');
|
lineArray.push(kanjiArray[indexNumber] ? kanjiArray[indexNumber] : '');
|
||||||
|
@ -16,8 +23,8 @@ function kanjiTable(kanjiArray) {
|
||||||
tableString += `${lineArray.join(' & ')} \\\\\n`
|
tableString += `${lineArray.join(' & ')} \\\\\n`
|
||||||
}
|
}
|
||||||
|
|
||||||
return `\\begin{tabular}{ ${'c '.repeat(xLength)}}
|
return `\\begin{longtable}{ ${'c '.repeat(xLength+1)}}
|
||||||
${tableString}\\end{tabular}`
|
${tableString}\\end{longtable}`
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.kanjiTable = kanjiTable;
|
exports.kanjiTable = kanjiTable;
|
|
@ -12,9 +12,10 @@
|
||||||
\newcommand{\jlptSection}[1]{
|
\newcommand{\jlptSection}[1]{
|
||||||
\section*{\uppercase{#1}}
|
\section*{\uppercase{#1}}
|
||||||
|
|
||||||
\resizebox{\textwidth}{!}{
|
\begin{center}
|
||||||
|
\fontsize{16}{16}
|
||||||
\input{./data/tables/#1.tex}
|
\input{./data/tables/#1.tex}
|
||||||
}
|
\end{center}
|
||||||
|
|
||||||
\localtableofcontents
|
\localtableofcontents
|
||||||
|
|
||||||
|
|
44
main.tex
44
main.tex
|
@ -20,7 +20,7 @@
|
||||||
\setlength{\parskip}{0.5em}
|
\setlength{\parskip}{0.5em}
|
||||||
\setlength{\parindent}{0pt}
|
\setlength{\parindent}{0pt}
|
||||||
|
|
||||||
\usepackage{longtable} %N1 table is too long.
|
\usepackage{longtable} % For multipage tables
|
||||||
|
|
||||||
%Japanese typesetting and fonts
|
%Japanese typesetting and fonts
|
||||||
\usepackage[japanese]{babel}
|
\usepackage[japanese]{babel}
|
||||||
|
@ -31,47 +31,47 @@
|
||||||
|
|
||||||
\input{./kanjiLib.tex}
|
\input{./kanjiLib.tex}
|
||||||
|
|
||||||
\usepackage{etoc} %For local tocs containing level based kanji list.
|
\usepackage{etoc} % For local tocs containing level based kanji list.
|
||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
|
|
||||||
\input{./title/titlepage.tex}
|
\input{./title/titlepage.tex}
|
||||||
|
|
||||||
\break
|
\break
|
||||||
|
|
||||||
\tableofcontents
|
\tableofcontents
|
||||||
\break
|
\break
|
||||||
|
|
||||||
\section*{Preface}
|
\section*{Preface}
|
||||||
|
|
||||||
%TODO: Add more detailed information
|
%TODO: Add more detailed information
|
||||||
|
|
||||||
Thanks to Timothy Eyre for making the Choumei font and the edition containing stroke order numbers. You can find his work at \url{https://www.nihilist.org.uk/}
|
Thanks to Timothy Eyre for making the Choumei font and the edition containing stroke order numbers. You can find his work at \url{https://www.nihilist.org.uk/}
|
||||||
|
|
||||||
Kanji data is taken from \url{https://jisho.org/}
|
Kanji data is taken from \url{https://jisho.org/}
|
||||||
|
|
||||||
This document splits the kanjis into JLPT levels. Please note that there is no official list of kanji JLPT levels. This list is based on \href{http://www.tanos.co.uk/jlpt/skills/kanji/}{tanos.co.uk}.
|
This document splits the kanjis into JLPT levels. Please note that there is no official list of kanji JLPT levels. This list is based on \href{http://www.tanos.co.uk/jlpt/skills/kanji/}{tanos.co.uk}.
|
||||||
|
|
||||||
\break
|
\break
|
||||||
|
|
||||||
\jlptSection{n5}
|
\jlptSection{n5}
|
||||||
|
|
||||||
\input{./data/testing/test.tex}
|
\input{./data/testing/test.tex}
|
||||||
|
|
||||||
\jlptSection{n4}
|
\jlptSection{n4}
|
||||||
|
|
||||||
% \input{./data/pages/n4.tex}
|
% \input{./data/pages/n4.tex}
|
||||||
|
|
||||||
\jlptSection{n3}
|
\jlptSection{n3}
|
||||||
|
|
||||||
% \input{./data/pages/n3.tex}
|
% \input{./data/pages/n3.tex}
|
||||||
|
|
||||||
\jlptSection{n2}
|
\jlptSection{n2}
|
||||||
|
|
||||||
% \input{./data/pages/n2.tex}
|
% \input{./data/pages/n2.tex}
|
||||||
|
|
||||||
\jlptSection{n1}
|
\jlptSection{n1}
|
||||||
|
|
||||||
% \input{./data/pages/n1.tex}
|
% \input{./data/pages/n1.tex}
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
Loading…
Reference in New Issue