Skip to content

Commit

Permalink
Merge pull request plk#4 from moewew/hungarianpages
Browse files Browse the repository at this point in the history
Rework page numbering
  • Loading branch information
marczellm committed Apr 5, 2018
2 parents 1990b2d + 2b2efe4 commit 6cfeb1c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 36 deletions.
6 changes: 6 additions & 0 deletions doc/latex/biblatex/biblatex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5116,6 +5116,12 @@ \subsubsection{Russian}

Like the Greek localisation module, the Russian module also requires \utf support. It will not work with any other encoding.

\subsubsection{Hungarian}
\label{use:loc:hun}

The Hungarian localisation files need to redefine certain field formats to obtain the grammatically correct word order. This means that these field formats are overwritten whenever the Hungarian localisation is active, no matter whether they were defined in the preamble or by a custom style. So please be aware that using the Hungarian localisation module may cause the bibliography output to deviate from the format dictated by the loaded style and preamble definitions. Changes to this behaviour need to be made using \cmd{DefineBibliographyExtras}. In particular \cmd{mkpageprefix} is redefined to output the page number as a suffix following Hungarian convention, additionally all formats of fields inolving pages were modified to make sure that page ranges are printed as ordinal ranges.


\subsection{Usage Notes}
\label{use:use}

Expand Down
62 changes: 26 additions & 36 deletions tex/latex/biblatex/lbx/magyar.lbx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@

\DeclareBibliographyExtras{%
\def\mkbibordinal#1{#1\adddot}%

% Page numbers and ranges
\savecommand\mknormrange
\renewrobustcmd*{\mknormrange}[1]{%
\begingroup
\@ifstar
{\blx@range@aux\blx@normrange@ii}
{\blx@range@aux\blx@normrange@ii[\mkbibordinal]{#1}}}%
% convenient shorthand for page range normalisation
\protected\def\lbx@hu@mkdottednormrange{\mknormrange*[\mkbibordinal]}%
% this redefines \mkpageprefix to put the page number as suffix
\savecommand\blx@mkpageprefix
\protected\long\def\blx@mkpageprefix#1[#2]#3{%
\blx@mkpageprefix@i[#2]{#3}%
Expand All @@ -23,39 +19,33 @@
{\ppspace\bibstring{#1s}}
{\def\pno{\bibstring{#1}}%
\def\ppno{\bibstring{#1s}}}}}%
\renewrobustcmd*{\blx@imc@mkpageprefix}[1][pagination]{%
\begingroup
\def\blx@tempa{\blx@mkpageprefix{page}}%
\iffieldundef{#1}
{}
{\iffieldequalstr{#1}{none}
{\def\blx@tempa{\blx@mkpageprefix@i}}
{\iffieldbibstring{#1}
{\edef\blx@tempa{\blx@mkpageprefix{\thefield{#1}}}}
{\blx@warning@entry{%
Unknown pagination type '\strfield{#1}'}}}}%
\@ifnextchar[%]
{\blx@tempa}
{\blx@tempa[\mknormrange]}}%
% NOTE: a few field formats are redefined here, this overrides corresponding
% style and preamble definitions.
% If you want to overwrite the changes made here, use
% \DefineBibliographyExtras{magyar}{...}
% Don not forget to make these changes undone with
% \UndefineBibliographyExtras{magyar}{...}
% to avoid them spilling out later.
\savefieldformat{pages}%
\DeclareFieldFormat{pages}{%
\mkpageprefix[bookpagination][\lbx@hu@mkdottednormrange]{#1}}%
\savefieldformat{postnote}%
\DeclareFieldFormat{postnote}{%
\mkpageprefix[pagination][\lbx@hu@mkdottednormrange]{#1}}%
\savefieldformat{volcitepages}%
\DeclareFieldFormat{volcitepages}{%
\mkpageprefix[pagination][\lbx@hu@mkdottednormrange]{#1}}%
\savefieldformat{multipostnote}%
\DeclareFieldFormat{multipostnote}{%
\mkpageprefix[pagination][\lbx@hu@mkdottednormrange]{#1}}%
}

\UndeclareBibliographyExtras{%
\restorecommand\mknormrange
\restorecommand\blx@mkpageprefix
\renewrobustcmd*{\blx@imc@mkpageprefix}[1][pagination]{%
\begingroup
\def\blx@tempa{\blx@mkpageprefix{page}}%
\iffieldundef{#1}
{}
{\iffieldequalstr{#1}{none}
{\def\blx@tempa{\blx@mkpageprefix@i}}
{\iffieldbibstring{#1}
{\edef\blx@tempa{\blx@mkpageprefix{\thefield{#1}}}}
{\blx@warning@entry{%
Unknown pagination type '\strfield{#1}'}}}}%
\@ifnextchar[%]
{\blx@tempa}
{\blx@tempa[\@firstofone]}}%
\restorefieldformat{pages}%
\restorefieldformat{postnote}%
\restorefieldformat{volcitepages}%
\restorefieldformat{multipostnote}%
}

\DeclareBibliographyStrings{%
Expand Down

0 comments on commit 6cfeb1c

Please sign in to comment.