I'd like to define a babel
language alias, which works identically as the original for the usual language selectors, babel
ones, or derived ones, such as those of csquotes
and biblatex
. Ideally, babel
shorthands for the original language would also work for the alias. For the sake of example, let's say I want to create a myenglishalias
from english
.
The use case here is that my documents commonly have two variants of my native language, my own text and a number of quotations from old sources, which use old spelling. Now, so far I haven't felt the need to treat them differently for LaTeX (hyphenation etc.), however, I'd like the editor to treat them differently (namely, to use different dictionaries for spellchecking). But I have to be able to differentiate the markup, so that the editor's parsing can identify the two language variants.
Some constraints:
I suppose an easy way out would be to make a copy of
english.ldf
, rename it, and add it to mytexmf
tree. However, I'd like the document to be compilable in any TeX installation, not just in my computer. So this must be handled at the document level.Technically, I could also just use an existing alias (there is actually one for the language of interest), but the markup would be semantically misleading. So I'd like to define a meaningful alias for the use case.
I don't know if this is possible and, if so, if it's worth it. But I'd like to consider the technical problem and assess this later. A look a the docs suggests \babelprovide
is likely the tool, but as far as I could grasp, I couldn't figure how to "import everything". Or perhaps there's some other way. I'm also not sure if the languages would actually be equivalent by using \babelprovide
, since the language of interest is .ldf
based, and \babelprovide
's import
seems to import from the .ini
file. But I think a "identity" is not really a strict requirement. As mentioned, the use case is for quotations, thus usually short pieces of text. As long as the alias behaves "close enough" to the original language, it'd be fine.
This is a MWE for the kind of thing I'd like to be able to achieve:
\documentclass{article}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}
\usepackage{lipsum}
\begin{document}
\section{Section 1}
\foreignlanguage{english}{\lipsum[1]}
\begin{otherlanguage}{english}
\lipsum[2-4]
\end{otherlanguage}
\foreignquote{english}{\lipsum[5]}
\hyphenquote{english}{\lipsum[6]}
\foreignblockquote{english}{\lipsum[7]}
\begin{foreigndisplayquote}{english}
\lipsum[8-10]
\end{foreigndisplayquote}
\begin{hyphendisplayquote}{english}
\lipsum[11-13]
\end{hyphendisplayquote}
\selectlanguage{english}
\lipsum[14-16]
\cite{sigfridsson}
\printbibliography
\section{Section 2}
What I'd like to do is for the following (and similar constructs) to be valid
and work just like if ``english'' was being selected.
% \foreignlanguage{myenglishalias}{\lipsum[1]}
%
% \begin{otherlanguage}{myenglishalias}
% \lipsum[2-4]
% \end{otherlanguage}
%
% \foreignquote{myenglishalias}{\lipsum[5]}
%
% \hyphenquote{myenglishalias}{\lipsum[6]}
%
% \foreignblockquote{myenglishalias}{\lipsum[7]}
%
% \begin{foreigndisplayquote}{myenglishalias}
% \lipsum[8-10]
% \end{foreigndisplayquote}
%
% \begin{hyphendisplayquote}{myenglishalias}
% \lipsum[11-13]
% \end{hyphendisplayquote}
%
% \selectlanguage{myenglishalias}
%
% \lipsum[14-16]
%
% \cite{sigfridsson}
%
% \printbibliography
\end{document}