Text FormattingHyphentation for T8-1

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Nessaiy
Posts: 1
Joined: Mon Sep 12, 2016 6:15 pm

Hyphentation for T8-1

Post by Nessaiy »

Hi,
I am writing my Bachelorthesis and I have to write T8-1 till T8-4 many times. I want that it is no hyphenation in it.

Code: Select all

\hyphentation{T8-1}

\hyphentation{T8\-1}

\hyphentation{T8"~1}
All of that says "Not a letter!"
How do I change that?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Hyphentation for T8-1

Post by Johannes_B »

If i understoof correctly what you want, that hyphen should never be used to split the item. Use a macro to typeset it.

Code: Select all

\newcommand{\Teighti}{\mbox{T8-1}}
\newcommand{\Teightii}{\mbox{T8-2}}
%etc ... Or
\newcommand{\Teight}[1]{\mbox{T8-#1}}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Hyphentation for T8-1

Post by cgnieder »

Your code seems to imply that you're using babel with German language shorthands? If that is true then the solution is easy:

Code: Select all

\documentclass{article}
\usepackage[ngerman]{babel}
\begin{document}

\parbox{0pt}{\hspace*{0pt}T8-1} % breaks

\parbox{0pt}{\hspace*{0pt}T8"~1} % does not break

\end{document}
For LaTeX numbers such as 1 or 8 and symbols such as the dash are no letters. And for \hyphenation words need to consist of letters. Within the argument of \hyphenation - has a special meaning: it specifies where a word is allowed to break. So even if 1 and 8 were letters

Code: Select all

\hyphenation{T8-1}
would show LaTeX where to break T81.

Regards
site moderator & package author
Post Reply