3

I have some lines of Sanskrit verse (left indented via a quoting environment) which are slightly too long, similar to the following example:

third line is too long.

\documentclass{memoir}
\usepackage{quoting}
\usepackage{fontspec}
\begin{document}
Some text
\begin{quoting}[rightmargin=0pt,indentfirst=false]
Some verse XXXXX XXXXXXX XXXXXXXXX XXXXX XXXX |\\
XXXXXXXX XXXXXXXX XXXX XXXXXXXXX XXXXX XXXX || 1 ||\\
Second verse XXXXXXXXXX XXXXX XXXX XXXXXXXXX |\\
XXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXXXX || 2 || \\
\end{quoting}
Some more text again.
\end{document}

Each half-verse is ended by a pipe-sign, and each full verse ended by the verse number enclosed in double pipe-signs. The second half of the first verse in the example is slightly too long, so that a line break occurs. I would now like to reduce inter word space and/or inter letter space just for this line in order to avoid the line break.

3

For a local change, you could set the leftmargin to something smaller than the default \leftmargin.

The package microtype helps, as so often. And you should put a tilde between parts you do not want to get separated.

% arara: lualatex

\documentclass{memoir}
\usepackage{quoting}
\usepackage{fontspec}
\usepackage{microtype}

\begin{document}
    Some text
    \begin{quoting}[rightmargin=0pt,indentfirst=false, leftmargin=.9\leftmargin] % your example just needs microtype but just to show...
        Some verse XXXXX XXXXXXX XXXXXXXXX XXXXX XXXX |\\
        XXXXXXXX XXXXXXXX XXXX XXXXXXXXX XXXXX XXXX ||~1~||\\
        Second verse XXXXXXXXXX XXXXX XXXX XXXXXXXXX |\\
        XXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXXXX ||~2~|| \\
    \end{quoting}
    Some more text again.
\end{document}

If you just need a little tweak here, I would recommend to put this globally in your preamble as \quotingsetup{leftmargin=.9\leftmargin} as this will change all your quotes. Better for consistency.

enter image description here

In any case, I would not do a real shrinking. That looks ugly IMO. It would be preferable to enter a line break at some good point and to flush the second line to the right.

| improve this answer | |
  • microtype doesn't do anything if I compile with xelatex, luatex is needed for that, is it? – muk.li Sep 2 '15 at 12:09
  • 1
    no, pdflatex will do fine, also. – JPi Sep 2 '15 at 12:25
  • 1
    @muk.li You should put such information in your post as XeLaTeX is not standard. I just guessed something due to your fontspec loading. I fear that XeLaTeX does not work (completely) with microtype – LaRiFaRi Sep 2 '15 at 12:29
2

If it is only from time to time and manual work is allowed, you can simply write

\documentclass{memoir}
\usepackage{quoting}
\usepackage{fontspec}
\usepackage{graphicx}
\begin{document}
Some text
\begin{quoting}[rightmargin=0pt,indentfirst=false]
Some verse XXXXX XXXXXXX XXXXXXXXX XXXXX XXXX |\\
\scalebox{0.95}[1]{XXXXXXXX XXXXXXXX XXXX XXXXXXXXX XXXXX XXXX} || 1 ||\\ % the precise value by an experiment
Second verse XXXXXXXXXX XXXXX XXXX XXXXXXXXX |\\
XXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXXXX || 2 || \\
\end{quoting}
Some more text again.
\end{document}

If the factor of x-transformation is close to 1 (0.95 in this example) the result should be acceptable.

| improve this answer | |
0

fontspec via its \addfontfeatures command actually allows one to conveniently adjust the settings for inter-word and inter-letter spaces for fonts loaded by it:

updated output

\documentclass{memoir}
\usepackage{quoting}
\usepackage{fontspec}
\setromanfont{Latin Modern Roman}
\newcommand\myshrink{\addfontfeature{WordSpace=0.95,LetterSpace=-0.5}}
\newcommand\myshrinkmore{\addfontfeatures{WordSpace=0.9,LetterSpace=-1}}
\newcommand\myshrinkevenmore{\addfontfeatures{WordSpace=0.85,LetterSpace=-1.5}}
\newcommand\myshrinkharder{\addfontfeatures{WordSpace=0.5,LetterSpace=-5}}

\begin{document}
Some text
\begin{quoting}[rightmargin=0pt,indentfirst=false]
Some verse XXXXX XXXXXXX XXXXXXXXX XXXXX XXXX |\\
%XXXXXXXX XXXXXXXX XXXX XXXXXXXXX XXXXX XXXX || 1 ||\\
%{\myshrink XXXXXXXX XXXXXXXX XXXX XXXXXXXXX XXXXX XXXX} || 1 ||\\
%{\myshrinkmore XXXXXXXX XXXXXXXX XXXX XXXXXXXXX XXXXX XXXX} || 1 ||\\
%{\myshrinkevenmore XXXXXXXX XXXXXXXX XXXX XXXXXXXXX XXXXX XXXX} || 1 ||\\
{\myshrinkharder XXXXXXXX XXXXXXXX XXXX XXXXXXXXX XXXXX XXXX} || 1 ||\\
Second verse XXXXXXXXXX XXXXX XXXX XXXXXXXXX |\\
XXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXXXX || 2 ||
\end{quoting}
Some more text again.
\end{document}
| improve this answer | |

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.