3

Problem Description

I am a newbie. I use microtype package. I would like to set the minimum width of a space to a width of a regular space. However, with default settings, it is shrinked too much and I think it makes the text less readable.

Minimal Working Example

%%%%%  Preamble  %%%%%
\documentclass[10pt]{book}
% \usepackage[a4paper]{geometry}
\usepackage[
    paperheight=7cm,
    paperwidth=21cm,
    top=1in,
    bottom=1in,
    right=1in,
    left=1in,
    portrait]{geometry}

\usepackage[slovak]{babel}
\usepackage{microtype}
\usepackage{xcolor}

% Font family
\usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
\setmainfont{Libertinus Serif}

% Paragraph and line settings
\setlength{\parindent}{0em}           % Set paragraph indentation
\setlength{\parskip}{0.08in}          % Paragraph spacing
\renewcommand{\baselinestretch}{1.0}  % Line \expandafter\selectlanguage\expandafter{\cvlang}

% Custom commands
\newcommand{\paragraphStyle}[1]{%
    \par
    \begingroup
        \setlength{\parindent}{0pt}%
        \setlength{\parskip}{0.16in}%
        \renewcommand{\baselinestretch}{1.0}%
        \fontsize{20pt}{24pt}\selectfont
        \noindent\color{black!100}%
        \bfseries\ignorespaces #1\par
    \endgroup
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
    \pagestyle{empty}
    \paragraphStyle{
        Pripomenieme si Pánovo zmŕtvychvstanie, budeme počúvať
    }
\end{document}

Output

output

  • Do you want to change this for your paragraph or generally for the font? – Ulrike Fischer Apr 25 at 14:59
  • @UlrikeFischer, I’d like to set it globally. – tukusejssirs Apr 25 at 15:37
4

You can use the WordSpace option to adjust the space. The value is a scale factor (3 is too much and only used for the demo here). It is also possible to adjust the stretch and shrink value individually, see the documentation of fontspec.

\documentclass[10pt]{book}

\usepackage[slovak]{babel}
\usepackage{microtype}
\usepackage{xcolor}

% Font family
\usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
\setmainfont{Libertinus Serif}[WordSpace={3}]
\begin{document}

        Pripomenieme si Pánovo zmŕtvychvstanie, budeme počúvať

\end{document}

enter image description here

4

enter image description here

\documentclass[10pt]{book}
% \usepackage[a4paper]{geometry}
\usepackage[
    paperheight=7cm,
    paperwidth=21cm,
    top=1in,
    bottom=1in,
    right=1in,
    left=1in,
    portrait]{geometry}

\usepackage[slovak]{babel}
\usepackage{microtype}
\usepackage{xcolor}

% Font family
\usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
\setmainfont{Libertinus Serif}

% Paragraph and line settings
\setlength{\parindent}{0em}           % Set paragraph indentation
\setlength{\parskip}{0.08in}          % Paragraph spacing
\renewcommand{\baselinestretch}{1.0}  % Line \expandafter\selectlanguage\expandafter{\cvlang}

% Custom commands
\newcommand{\paragraphStyle}[1]{%
    \par
    \begingroup
        \setlength{\parindent}{0pt}%
        \setlength{\parskip}{0.16in}%
        \setlength\spaceskip{12pt plus 2pt minus 2pt }% word space
        \setlength\xspaceskip{14pt plus 4pt minus 2pt }% end of sentence space
        \renewcommand{\baselinestretch}{1.0}%
        \fontsize{20pt}{24pt}\selectfont
        \noindent\color{black!100}%
        \bfseries\ignorespaces #1\par
    \endgroup
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
    \pagestyle{empty}
    \paragraphStyle{
        Pripomenieme si Pánovo zmŕtvychvstanie, budeme počúvať
    }
\end{document}
  • Could you explain that (x)spaceskip? I think the space between words are now too wide. Is there a way to dynamically check/get the width of a space in particular font and set that width as minimal space width? – tukusejssirs Apr 25 at 15:37
  • This is better: \setlength\spaceskip{7pt plus 2pt minus 2pt }\n\setlength\xspaceskip{14pt plus 4pt minus 2pt }, however, I have no idea what I am doing. ;) – tukusejssirs Apr 25 at 15:43
  • And this solution moves the test in that particular line out into right margin (see here). – tukusejssirs Apr 25 at 15:57
  • The \sloppy fixed the overflow. – tukusejssirs Apr 25 at 16:03

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.