6

I have a long sanskrit compound taking up almost a line, but leaving a small space at the right margin empty, too small for the first syllable of the next word, thus breaking the justified alignment. See example in footnote 1. Taking inspiration from this question I did some experiments with the soul package, with an almost satisfying result, see footnote 2, but the word's last letter disappeared.

MWE:

\documentclass{memoir}
\usepackage{soul}
\usepackage{calc}
\usepackage{fontspec}

\setlength{\footmarkwidth}{\leftmargin}
\setlength{\footmarksep}{0em}
\footmarkstyle{#1\hfill}

\sodef\spaceout{}{0em plus 1fil}{0em plus 1fil}{0em plus 1fil}
\begin{document}
\footnote{aśeṣavācyavācakātmakajagadabhedacamatkārātmakaśabdarāśivimarśaparamārthā sar\-vamantrāraṇis tatra tatrāgameṣu nirdiśyate | sā caiṣā viśvāvamarśanena paraṃ jñānaṃ prayacchati.}
\footnote{\makebox[\textwidth-\footmarkwidth][l]{\spaceout{aśeṣavācyavācakātmakajagadabhedacamatkārātmakaśabdarāśivimarśaparamārthā}} sar\-vamantrāraṇis tatra tatrāgameṣu nirdiśyate | sā caiṣā viśvāvamarśanena paraṃ jñānaṃ prayacchati.}
\end{document}

two footnotes

EDIT: This question seems related. Adding the three lines

\makeatletter
\sbox0{\ttfamily\global\let\SOUL@tt\ttfamily} 
\makeatother

to circumvent soul's choice of a font not containing the necessary diacritical combinations brings me a bit closer to a solution, the ā is preserved, but I get a ! Package soul Error: Reconstruction failed. and the following output containing a small black box:tried changing the font. Obviously soul tries to hyphenate the long word (which it shouldn't do) and fails to do so.

3

I can’t explain why soul chokes on your text, but since you’re using fontspec, perhaps you’re also compiling with luatex, and in that case you can play with chickenize, which seems to do the trick.

Use it this way:

\documentclass{memoir}
\usepackage{fontspec,chickenize}
\begin{document}
\letterspaceadjust% letterspace globally to improve greyness
blah blah blah
\end{document}

or this way:

\documentclass{memoir}
\usepackage{fontspec,chickenize}
\begin{document}
blah blah blah

\textletterspaceadjust{Letterspace this sentence to improve its greyness.}
\end{document}

EDIT:

Here’s a third way to use chickenize. As muk.li commented, the second introduces an unwanted space at the beginning of the note; as for the first, its global reach may be undesirable. But using \letterspaceadjust before the text you want to affect and \unletterspaceadjust after seems to avoid both problems:

\documentclass{memoir}
\usepackage{chickenize,fontspec}

\setlength{\footmarkwidth}{\leftmargin}
\setlength{\footmarksep}{0em}
\footmarkstyle{#1\hfill}

\begin{document}
\letterspaceadjust
\footnote{aśeṣavācyavācakātmakajagadabhedacamatkārātmakaśabdarāśivimarśaparamārthā sar\-vamantrāraṇis tatra tatrāgameṣu nirdiśyate | sā caiṣā viśvāvamarśanena paraṃ jñānaṃ prayacchati.}

\unletterspaceadjust
\footnote{aśeṣavācyavācakātmakajagadabhedacamatkārātmakaśabdarāśivimarśaparamārthā sar\-vamantrāraṇis tatra tatrāgameṣu nirdiśyate | sā caiṣā viśvāvamarśanena paraṃ jñānaṃ prayacchati.}
\end{document}

output of MWE

  • I use xelatex. I've tried your second suggestion, giving me the following output: testing chickenize. Not exactly what I want, but pointing me to a possible, a bit less ugly workaround of adding some empty space at the beginning of the line. – muk.li Jun 15 '15 at 5:11
  • Or I believe that you can use \textletterspaceadjust{SomeStuff} rather than \unletterspaceadjust – A Feldman May 25 '16 at 8:20
1

I now found a way to solve it without soul (which is not maintained anymore, and not particularly suited to work with unicode(?)). I just had to adapt this answer to abovementioned question. It is particularly applicable to this case as the line concerned contains only one word, thus no inter-word-spaces, which would otherwise create problems. For reference the working example below:

\documentclass{memoir}
\usepackage{calc}
\usepackage{fontspec}

\setlength{\footmarkwidth}{\leftmargin}
\setlength{\footmarksep}{0em}
\footmarkstyle{#1\hfill}

\makeatletter
\def\spreadeven#1{%
\@tfor\next:=#1\do{%
  \next\hfill
 }%
}
\makeatother

\begin{document}

\footnote{aśeṣavācyavācakātmakajagadabhedacamatkārātmakaśabdarāśivimarśaparamārthā sar\-vamantrāraṇis tatra tatrāgameṣu nirdiśyate | sā caiṣā viśvāvamarśanena paraṃ jñānaṃ prayacchati.}
\footnote{\makebox[\textwidth-\footmarkwidth][l]{\spreadeven{aśeṣavācyavācakātmakajagadabhedacamatkārātmakaśabdarāśivimarśaparamārthā}} sar\-vamantrāraṇis tatra tatrāgameṣu nirdiśyate | sā caiṣā viśvāvamarśanena paraṃ jñānaṃ prayacchati.}
\end{document}

I guess that's good enough a solution. Theoretically it would be nice to also incorporate the \makebox command into the \spreadeven macro, but the fact that the length of the box can differ makes it difficult.

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.