3

Updated the text a little, due to Mico's comment (regarding all or only some ligatures)

I am using the package paracol with XeLaTeX, having created two columns, and I am using ligatures. I wish to disable the rare and historic ligatures for the second column and keep them for the first (at least for the moment). The common ligatures, such as ff, fi, and so forth, must remain.

Question: what is the quickest and easiest way to accomplish that?

Extra update: added another specific thing that falls under the main question: After the first matter is solved (i.e., in the second column only the common ligatures are allowed), how then does one proceed to disable certain specific ligatures in the first column? I mean this: yes, I wish to have historic and rare ligatures for the first column, except for a few specific ones, such as the double aa but especially the ones with two consonants joined (such as gr and kr and so forth).

UPDATED WITH CODE (29-4-17):

\documentclass[12pt, a4paper, titlepage]{book}
\usepackage{paracol}
\usepackage{lipsum}
\usepackage{polyglossia}
\setmainlanguage{english}
\setmainfont[Ligature=Historic,Ligature=Rare]{Junicode}

\title{Title}
\author{Author}

\begin{document}
\frontmatter
   \begin{titlepage}
   \maketitle
   \thispagestyle{empty}
   \end{titlepage}


\chapter{Foreword}
\begin{paracol}{2}
   %% here starts the first column; while I wish to use the rare and 
    % historic ligatures in this first column, here I wish to disable e.g. 
   %  „gr” and „kr”
   \lipsum
   \switchcolumn
   %% having switched, here, for the second column, I want to disable the 
   % rare and historic ligatures, keep the common ones (ff, fi, etc.), and still use the 
   % same font as in the first, while the first column keeps all ligatures 
   % as it is
   \lipsum
\end{paracol}

\end{document}
  • 2
    Use different font setups in both columns, one with ligature, the other without. – Ulrike Fischer Apr 28 '17 at 22:31
  • Is using LuaLaTeX instead of XeLaTeX an option for you? – Mico Apr 29 '17 at 6:21
  • Mico, I would prefer to stick to XeLaTeX for the moment, due to unicode and font flexibility, unless in this area at the very moment LuaLaTeX is better. @Alan, it is due to time and the like and I did not have my file at hand. – Jermain Apr 29 '17 at 13:22
  • 1
    @Jermain - Judging by the code you've posted, you actually don't want to suppress all ligatures in the second column -- just the 'historic' and 'rare' ones. In contrast, you do want to keep using the 'common' ligatures (such as ff, fi, fl, ffi, and ffl) in the second column, right? Is this impression correct? Please advise. – Mico Apr 29 '17 at 13:58
  • @Mico---hmmm, indeed, regarding common ligatures: the common ligatures, such as ff, fl, fi, and so forth, must stay. I will have to adapt my original post accordingly. – Jermain Apr 29 '17 at 15:17
3

Here's a semi-automatic way to do it. It's semi-automatic because in some environments you will need to change the font manually. The paracol package is very complex, and provides no hooks to set the font on a per-column basis.

This code works automatically for the following environments:

  • simple environment using \switchcolumn
  • {leftcolumm} and {rightcolumn} environments
  • starred versions of these commands/environments

For other environments such as footnotes, tables, and figures I've provided a command that automatically sets the font for the current column number:

\setcolfont

For example:

\footnote{\setcolfont Footnote text}

If I figure out a way to do it more automatically I will update the answer.

\documentclass{article}
\usepackage{paracol}
\usepackage{fontspec}
\usepackage{etoolbox}

% Define font families for Col 0 and Col 1
% Add more for more column documents if needed
\expandafter\newfontfamily\csname juni0\endcsname[Ligatures={Historic,Rare}]{Junicode}
\expandafter\newfontfamily\csname juni1\endcsname[]{Junicode}
% The following commands are added for convenience in case each font is needed elsewhere
% They also make the environment patching code more readable
\newfontfamily\junicodeHistoric[Ligatures={Historic,Rare}]{Junicode}
\newfontfamily\junicodeNoLig[]{Junicode}

% Patch the right and left column environments
\AtBeginEnvironment{leftcolumn}{\junicodeHistoric}
\AtBeginEnvironment{leftcolumn*}{\junicodeHistoric}
\AtBeginEnvironment{rightcolumn}{\junicodeNoLig}
\AtBeginEnvironment{rightcolumn*}{\junicodeNoLig}

\makeatletter
% Define a command to set the font to the current column number
\newcommand{\setcolfont}{%
\csname juni\number\pcol@currcol\endcsname%
}

%% Optional code for use with selnolig
%\usepackage{selnolig}
%% Define global noligs 
%\nolig{aa}{a|a} % Examples change as needed
%\nolig{al}{a|l}
%\nolig{an}{a|n}
%\nolig{ar}{a|r}
%\nolig{av}{a|v}
%% End optional code for selnolig


% Patch the \switchcolumn command and paracol environments to set the column font
\appto{\pcol@switchcol}{\setcolfont}{}{}
\preto{\paracol}{\setcolfont}{}{}
\makeatother

\usepackage[]{kantlipsum}
\begin{document}
\begin{paracol}{2}
% Test with switchcolumn
Ideal\kant[1]
\switchcolumn
After\kant[1]
% Test with leftcolumn/rightcolumn
\begin{leftcolumn}
\kant[2]%
% Footnotes need to have explicit \setcolfont commands
\footnote{\setcolfont 
This is a left column footnote.}
\end{leftcolumn}
\begin{rightcolumn}
\kant[2]%
\footnote{\setcolfont
This is a right column footnote.}
\end{rightcolumn}
\switchcolumn*
\kant[3]
% Tables/figures need to have explicit \setcolfont commands
\begin{table}[tbp]
\setcolfont
This is a left column table. Ideal It is set in the left font.
\end{table}
\switchcolumn
\kant[3]
\end{paracol}

\end{document}

output of code

Adapting to use selnolig package

If you wish to have finer control over the ligatures in the text you can use Mico's selnolig package to selectively turn off some ligatures. This requires LuaTeX to run. There's no way to turn off ligatures selectively per column, it seems as the \nolig commands are effectively global. (See Mico's comments below.)

  • Did you mean to write the option as Ligatures={Historic,Rare} instead of as Ligatures={Historic,Common}? (The 'common' ligatures are enabled by default...) – Mico Apr 29 '17 at 16:38
  • 1
    @mico Yes, thanks. I'll update. (BTW, paracol is impressive, isn't it!) – Alan Munn Apr 29 '17 at 16:39
  • @AlanMunn: thanks, too. I will for the moment try Mico's answer and let you know. – Jermain Apr 29 '17 at 18:57
  • @Jermain My solution and Mico's are very similar; mine is a bit more general, at the moment but can easily be adapted to use selnolig as well. – Alan Munn Apr 29 '17 at 18:59
  • 1
    I must confess that it hadn't occurred to me that it would be useful to delimit the scope of selnolig's routines in the way you had in mind, but I do agree that it could actually be quite useful. The package does provide two macros, \selnoligoff and \selnoligon, to suspend and restart operations entirely. However, that's not nearly as flexible as what your earlier setup would require. Something to do in a future update of the package! – Mico Apr 29 '17 at 21:29
2

The following answer builds on an early version of @AlanMunn's (temporarily deleted, later re-instated) answer. I.e., I maintain the use of etoolbox machinery to employ separate fonts for the left-hand and right-hand columns. In addition, I switch from XeLaTeX to LuaLaTeX in order to be able to make use of the selnolig package, which provides a method for globally disabling some of Junicode's ligatures, such as those for aa, al, an, ar and av. (Full disclosure: I'm the primary author of this package.)

I trust that switching from XeLaTeX to LuaLaTeX won't be much of a task for you.

enter image description here

\documentclass{article}
\usepackage{polyglossia} 
\setmainlanguage{english}
\usepackage{paracol,fontspec}
\newfontfamily\junicodeHistoric[Ligatures={Historic,Rare}]{Junicode}
\newfontfamily\junicodeNoLig[]{Junicode}

\usepackage{etoolbox}
\AtBeginEnvironment{leftcolumn}{\junicodeHistoric}
\AtBeginEnvironment{rightcolumn}{\junicodeNoLig}
\usepackage{kantlipsum}

\usepackage{selnolig} % must be used with LuaLaTeX
\debugon % optional -- leave an activity trail in log file
% Globally suppress the following ligatures:
\nolig{aa}{a|a} 
\nolig{al}{a|l}
\nolig{an}{a|n}
\nolig{ar}{a|r}
\nolig{av}{a|v}
% feel free to provide further \nolig directives...

\begin{document}
\begin{paracol}{2}
\begin{leftcolumn}
\kant[1]
\end{leftcolumn}
\begin{rightcolumn}
\kant[1]
\end{rightcolumn}
\end{paracol}

\end{document}
  • The reason I deleted my answer was that it's not general enough. paracol has a bunch of environments, each of which would need to be patched. This also doesn't get footnotes correctly, and (I suspect) a bunch of other things. A proper solution would hook into the more general column switching code, but the paracol code is very dense, and lightly commented. – Alan Munn Apr 29 '17 at 17:55
  • @AlanMunn -- Indeed, the paracol package provides quite a few environments. I would hope that as long as we provide reasonably clear example code, the OP will figure out how to extend the code to cover his/her needs. – Mico Apr 29 '17 at 17:57
  • That seems overly optimistic. This is a really tricky problem to solve. – Alan Munn Apr 29 '17 at 17:59
  • @AlanMunn - Let's see if the OP weighs in with more information, specifically, about how he/she uses the facilities of the paracol environment. – Mico Apr 29 '17 at 18:06
  • @Mico: your selnolig package looks very promising. I see that if I were to try your code, I MUST use LuaLaTeX. Hmmm, it also supports UTF-8 very well, I recall. It might pose a problem for me. Suppose I were to add two extra languages next to English (e.g., Greek and Hebrew): how should this be incorporated? (I have hardly used LuaLaTeX.) With XeLaTeX I had it already set, and maybe I must now have that changed. I will let you know how it went. – Jermain Apr 29 '17 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.