# What's the easiest way of putting a fixed-width space?

I got some Polish text with dialogues throughout it. I just learned that in Polish typography every statement in a dialogue is started by a dash followed by a fixed-width space. Now I have plenty of cases like this:

\textit{--- Jaki jest język wietnamski?} \\
\textit{--- Język wietnamski nie jest trudny.} \\


which produces:

It is evident that this is not a fixed-width space. I found some descriptions of how to get fixed-width spaces in some text in "Fixed-width interword space" but that looks too complex to me to be used in this case. Is there any easy way of changing these very spaces (these following the "opening" dashes) to fixed-width ones? Defining some fixed-width space (\newcommand) might also work...

I'd use some simple macro such as \def\fs{\kern 0.33em}:

\textit{---\fs Jaki jest język wietnamski?} \\
\textit{---\fs Język wietnamski nie jest trudny.} \\


Put this in the preamble

\newcommand{\opendialog}{---\enspace}
\newcommand{\dialog}[1]{\opendialog\textit{#1}}


and, in the document,

\dialog{To be or not to be, that is the question}


Full example:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[polish]{babel}

\newcommand{\opendialog}{---\enspace}
\newcommand{\dialog}[1]{\opendialog\textit{#1}}

\setlength{\textwidth}{5.1cm} % just to make the text wrap

\begin{document}

\dialog{Jaki jest język wietnamski?}

\dialog{Język wietnamski nie jest trudny.}

\end{document}


Instead of \enspace that makes a space of 0.5em, you might want to use a smaller one. The big advantage of using macros is that you can change the overall appearance just by acting in a single place.

• Is it my eyes (or my age) or the curved serifs in J are not aligned? – Sigur Aug 27 '15 at 16:53
• @Sigur It's a misfeature of microtype. :( Removed. – egreg Aug 27 '15 at 17:04
1. load babel with your language in order to get the right hyphenations
2. load microtype which fixes many of those problems
3. put the dialogue in a group and put \RaggedRight in it. This will flush everything to the left. I would recommend to write a command or environment for this.

% arara: pdflatex

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[polish]{babel}
\setlength{\textwidth}{4.3cm} % guessing something which produces your screen-shot
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage{blindtext} %just for demo

\begin{document}
\blindtext

\noindent
{\RaggedRight
\textit{--- Jaki jest język wietnamski?} \par
\textit{--- Język wietnamski nie jest trudny.} \par
}
\noindent
\blindtext
\end{document}


Such a custom command could be

\newcommand{\dialogowac}[1]{{\par\RaggedRight\textit{--- #1}\par}}


But this will have no indent if you start a new paragraph.

• here, microtype has the perhaps unwanted side-effect of shifting the dash out into the lift margin. (there may be a way to turn this off, but there could be other side effects.) – barbara beeton Aug 27 '15 at 17:49

Would you use the unicode em-dash? In that case you can use some magic. Any line starting with — (the unicode em-dash) would take the next paragraph as argument and put it in italics (or any format you want).

\documentclass{scrartcl}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[polish]{babel}

\DeclareUnicodeCharacter{2014}{\ifvmode\expandafter\bdialog\else\textemdash\fi}

\newcommand*\opendialog{\textemdash\,} % <- You can change here the \, to
%    any horizontal space you want.
\newcommand\dialog[1]{\opendialog\textit{\ignorespaces#1}\par}
\long\def\bdialog#1\par{\dialog{#1}}

\begin{document}

—Jaki jest język wietnamski?

—Język wietnamski nie jest trudny.

\end{document}


Note: You need to leave a blank line so the paragraph is taken as an argument, for instance, after a — your document can't be

—Whatever.\end{document}


You need a blank line or an explicit \par token like

—Whatever.

\end{document}


or

—Whatever.\par
\end{document}


Thanks to all ideas given above, here's the easiest thing to do: Just put \kern 0.33em behind every "opening" dash (every other solution demands some editing throughout the document anyway).

\textit{---\kern 0.33em Jaki jest język wietnamski?} \\
\textit{---\kern 0.33em Język wietnamski nie jest trudny.} \\


This produces: However to change the width, all the editing work will have to be done again.

• However to change the width, all the editing work will have to be done again. So, is this solution really easier than the accepted answer? – Johannes_B Aug 27 '15 at 16:48
• It is, as long as you are sure that you won't change it any more. – Dominik Aug 27 '15 at 16:59
• But the answer you accepted is more robust and less typing ;-) Unless you have just two instances of that fixed space. – Johannes_B Aug 27 '15 at 17:09