I use the \nobreakdash
command to disallow a linebreak after the dash in short expressions like -s, -ar etc. I use ({\nobreakdash}-s
, {\nobreakdash}-ar
) but it seems not work as can be seen on the picture below.
Here comes minimul example:
\documentclass[10pt,a4paper,twocolumn]{extbook}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\usepackage[top=2cm, headsep=0.4cm, bottom=1.5cm, left=1.5cm, right=1.5cm]{geometry}
\usepackage{fancyhdr}
\usepackage[icelandic, latin, czech]{babel}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{00A0}{~} % finds hidden non-breakable space
\usepackage[T1]{fontenc}
\usepackage{tgpagella}
\usepackage[scaled=0.90]{helvet} % ss
\usepackage{hanging}
\usepackage{makeidx}
\usepackage{tipa}
\usepackage{fix2col}
\usepackage{color}
\usepackage{titlesec}
\usepackage{amsmath} %used for non-breakabledash
\usepackage{hyphenat} % no hyphen in abbreviations
% COLORS
\definecolor{darkgreen}{rgb}{0.4, 0.01, 0.24}
%COMMANDS
\newcommand\entry[3][]{\hangpara{2em}{1}{\fontfamily{phv}\selectfont{\textbf{{#2}}}}\
#3\ifx\relax#1\relax\markboth{#2}{#2}\else\markboth{#1}{#1}\fi
\par}\nopagebreak[4]
\newcommand\n{$n$\nobreakdash-\hspace{0pt}} %nonbreakable dash in grammar endings
\def \nobreakseq {\nobreak \hskip 0pt \hbox} %nolinebreak in case like (-s, -)
% DICTIONARY PAGE STYLE
\fancypagestyle{dictstyle}{%
\renewcommand{\headrulewidth}{0.4pt}
\fancyhf{}
\fancyhead[LE,LO]{{\fontfamily{phv}\selectfont{\textbf{\rightmark}}}}
\fancyhead[CO,CE]{\thepage}%the page numbers will be printed when the dictionary is ready
\fancyhead[RE,RO]{{\fontfamily{phv}\selectfont{\textbf{\leftmark}}}}}
\setlength{\columnsep}{20pt}
\setlength{\columnseprule}{0.1pt}
\newcommand{\HRule}{\rule{\linewidth}{0.1mm}} % rule line
\begin{document}
\twocolumn
\pagestyle{dictstyle}
\entry[stjórnmálafræðingur]{{stjórn$\cdot$mála$\cdot$$\cdot$fræðing|ur}}{{\textipa{[{s}{\textsubring{d}}{j}{ou}{r}{\textsubring{d}}{\textsubring{n}}{m}{au}{l}{a}{f}{r}{a}{i}{ð}{i}{\ng}{\r{g}}{\textscy}{\textsubring{r}}]}}{\color{darkgreen}{\small{\textbf{ m}}}}{\color{darkgreen}{\footnotesize{ (\nobreakdash-s, \nobreakdash-ar)}}}\foreignlanguage{czech}{{ politolog, politoložka}}.}
\end{document}
Best Answer
Don't surround
\nobreakdash
with braces.EDIT: Your added example was anything but minimal, but I was able to track down the culprit:
\usepackage[czech]{babel}
makes the hyphen (-
) an active character, which seems to break\nobreakdash
. Solution/workaround: Replace\nobreakdash-
with\hbox{-}
.