Skip to content

Commit

Permalink
Merge pull request #248 from wdw21/20250928-truncate
Browse files Browse the repository at this point in the history
Trucating too long song title in page header. Page numbering with letters.
  • Loading branch information
ptabor authored Sep 28, 2024
2 parents 450556c + 1281fec commit 375e95f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion containers/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WORKDIR /app
ENV TZ=Europe/Warsaw
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get -yq install texlive texlive-latex-extra texlive-lang-polish pip pkg-config libicu-dev epubcheck python3-markupsafe python3-icu python3-lxml python3-jinja2 python3-yaml git curl && apt-get clean

#RUN tlmgr install truncate
#COPY ../requirements.txt /tmp/requirements.txt
#RUN pip3 install -r /tmp/requirements.txt
CMD ["/bin/bash"]
7 changes: 6 additions & 1 deletion src/formats/single_p.tex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{dcolumn}
\usepackage[fit]{truncate}
\usepackage{mfirstuc}


\renewcommand{\familydefault}{\sfdefault}
\usepackage{helvet}
Expand All @@ -22,7 +25,7 @@
\newindex{aliases}{aadx}{aind}{Indeks tytułów}
\newindex{genre}{gadx}{gind}{Indeks gatunków}

\geometry{scale={0.95,0.85},pdftex,top={3ex}}
\geometry{scale={0.95,0.90},pdftex,top={3ex}}
\addtolength{\headheight}{5ex}

\setboolean{PrintChordsOn}{true}
Expand All @@ -35,6 +38,8 @@
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\chapter}[2]{\newpage\vbox{\LARGE{\bf #2}\\}}

\newcommand{\theLetter}{}

\pagestyle{fancy}
\fancyfoot[RE,LO]{http://songbook.21wdw.org/}
\fancyfoot[LE,RO]{\thepage}
Expand Down
9 changes: 6 additions & 3 deletions src/formats/songbook_p.tex
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
\usepackage{dcolumn}
\usepackage{qrcode}
\usepackage{index}
\usepackage{mfirstuc}
\usepackage[fit]{truncate}

\newindex{wyk}{wadx}{wind}{Indeks wykonawców}
\newindex{aliases}{aadx}{aind}{Indeks tytułów}
Expand All @@ -33,8 +35,7 @@
\usepackage{helvet}


%\geometry{scale={0.90,0.80},pdftex} \addtolength{\headheight}{2pc}
\geometry{scale={0.95,0.85},pdftex,top={3ex}}
\geometry{scale={0.95,0.90},pdftex,top={3ex}}
\addtolength{\headheight}{5ex}

\setboolean{PrintChordsOn}{true}
Expand All @@ -44,12 +45,14 @@
\setlength{\parindent}{0pt}
\setlength{\headsep}{10pt}

\newcommand{\theLetter}{}

\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\chapter}[2]{\newpage\vbox{\LARGE{\bf #2}\\}}

\pagestyle{fancy}
\fancyfoot[RE,LO]{:url:}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[LE,RO]{\thepage{} \theLetter}
\fancyfoot[CE,CO]{}
\fancyhead[RE,LO]{\today}

Expand Down
25 changes: 19 additions & 6 deletions src/latex/songbook21wdh.sty
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,42 @@
{\ifthenelse{\boolean{PrintSongNum}}{\theSongCnt{}.\ }{}{\bf #1\\}}}%
}%

%The macto \firstof returns the first letter (and works with UTF-8 chars).
\makeatletter
\newcommand{\firstof}[1]{\expandafter\checkfirst#1\@nil}
\def\checkfirst#1{%
\ifx\UTFviii@two@octets#1%
\expandafter\gettwooctets
\else
\expandafter\@car\expandafter#1%
\fi
}
\def\gettwooctets#1#2#3\@nil{\UTFviii@two@octets#1#2}


\newenvironment{song}[8]{
\clearpage%
\fancyhead[LE]{#1}%
\fancyhead[RO]{#1}%
\newenvironment{song}[8]{%
\fancyhead[LE,RO]{\truncate{0.5\headwidth}{#1}}%
\setcounter{VerseCnt}{0}%
\renewcommand{\theSongTitle}{#1}%
\renewcommand{\theSongLyricist}{#2}%
\renewcommand{\theSongComposer}{#3}%
\renewcommand{\theSongArtist}{#4}%
\renewcommand{\theLetter}{\firstof{#1}}%
% #7 - alias #8- genre
\addtocounter{SongCnt}{1}%
\index[wyk]{#4!#1}
\index[aliases]{#1}
\index[aliases]{#8!#1}
\index[genre]{#7!#1}
\index[genre]{\makefirstuc{#7}!#1}
\addcontentsline{toc}{section}{\theSongCnt{}. #1}%
% \addcontentsline{toc}{section}{alias title}
\STitle{\theSongTitle}%
\vspace{5pt plus 5pt minus 5pt}%
\AAndCAndAAndMusic{#2}{#3}{#4}{#5}{#6}%
\parindent=0pt%
}{}
}{%
\clearpage%
}

\newcommand{\calb}[0]{\vline width 2pt {}}%

Expand Down

0 comments on commit 375e95f

Please sign in to comment.