2

I am using a tilde in the defined \quoteboxtable because I do not want a line break to occur between the dash and the name of the person being quoted. However, justification of the line is taking priority over my non-breaking space. While I do not want the column to be ragged right in general, I do not mind if the last line of the quote is not justified, so long as the tilde is respected. How can I prioritize the non-breaking space over the justification?

Minimal working example:

\documentclass[10pt,conference]{IEEEtran}
\usepackage{ifthen}
\newcommand{\quoteboxtable}[2]{\textit{``#2''}\ifthenelse{\equal{#1}{}}{}{ -~#1}}
\begin{document}


\begin{table}

    \begin{tabular}{p{0.18\linewidth}p{0.73\linewidth}}

    Abcdefghijkl 
    & \quoteboxtable{Someone}{a bcdefghij klmno pqrstuv wxyza bc de fghi. Jkl mn o pqrstuvw  xyzabcdefghij klmno, pqr stu vwxyzabc.}\\
    
    \end{tabular}

\end{table}

\end{document}

The example produces:

Incorrect line break

1 Answer 1

4

You are adding an explicit break point before the ~ with -, you can use \mbox{-} for a non-breaking hyphen

\documentclass[10pt,conference]{IEEEtran}
\usepackage{ifthen}
\newcommand{\quoteboxtable}[2]{\textit{``#2''}\ifthenelse{\equal{#1}{}}{}{ \mbox{-}~#1}}
\begin{document}


\begin{table}

    \begin{tabular}{p{0.18\linewidth}p{0.73\linewidth}}

    Abcdefghijkl 
    & \quoteboxtable{Someone}{a bcdefghij klmno pqrstuv wxyza bc de fghi. Jkl mn o pqrstuvw  xyzabcdefghij klmno, pqr stu vwxyzabc.}\\
    
    \end{tabular}

\end{table}

\end{document}

enter image description here

1
  • 1
    Thank you, that solved it!
    – Ann
    Commented Aug 26, 2022 at 1:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .