Featured Book

LaTeX Beginners Guide

Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 9 guests

Partner Sites

TeXwelt - Fragen und Antworten goLaTeX
TeXblog
TeXnicCenter
TeXample

Don't split words on certain letters

Add tags Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)

Don't split words on certain letters

Postby eleanor on Sun Jul 29th, 2012

Hi,

I'm writing a document in latex. It's in my native language, Slovenian. And the rules for splitting words across multiple lines are a little bit different: the splitted word in new line should not start with letters: a,e,i,o,u and there are some other rules.

Is there any way to let Latex know about these rules? Does latex have a command, which can declare appropriate rules in any language, including Slovenian?

If not, how can I prevent Latex from splitting words on such letters. And I want a solution that affects whole document correctly, I don't want to mark each word separately.

Thanks
eleanor
 
Posts: 19
Joined: Sat Oct 3rd, 2009

Re: Don't split words on certain letters

Postby Stefan_K on Sun Jul 29th, 2012

Hi Eleanor,

I recommend to use babel:
Code: Select all  •  Open in writeLaTeX
\usepackage[slovene]{babel}

or polyglossia, the latter with XeTeX.

You could implement your own special hyphenation rules using the pre_linebreak_filter callback (or a token_filter callback) with LuaTeX. Or, with XeTeX, your could use \XeTeXinterchartoks. In any way, you could insert \nobreak commands.

Stefan
LaTeX Community Administrator
User avatar
Stefan_K
Site Admin
 
Posts: 6379
Joined: Mon Mar 10th, 2008
Location: Hamburg, Germany

Re: Don't split words on certain letters

Postby eleanor on Mon Jul 30th, 2012

Hi, thanks for quick reply.

I'm already using:
Code: Select all  •  Open in writeLaTeX
\usepackage[slovene]{babel}


And from your answer I guess, this should be enough. But it isn't. The words are still splitted wrongly. A small example is the following code:
Code: Select all  •  Open in writeLaTeX
\documentclass[12pt,a4paper,openany]{book}
\usepackage{fancyhdr}
\usepackage{graphicx,epsfig}
\usepackage[slovene]{babel}
\usepackage{longtable}
\usepackage[raggedrightboxes]{ragged2e}


\begin{document}
\chapter*{Testing}
  \begin{longtable}[l]{p{3.5cm}p{3.5cm}p{8cm}}
    \hline
    \textbf{Napad z vrinjenjem zlonamerne kode} & Cross-site scripting\newline XSS & Napad na spletno stran z vrinjenjem zlonamerne kode, napisane v skriptnem jeziku, npr. z namenom kraje piškotkov. \\\hline
  \end{longtable}

\end{document
}


When running pdflatex test.tex, the third column contains the following text:
Napad na spletno stran z vrinjenjem zlon-
amerne kode, napisane v skriptnem jeziku,
npr. z namenom kraje pikotkov.


Notice that the word "zlonamerne" is splitted on the 'a' boundary. The letter 'a' should not be put into the next line, but should be on the previous line or the word should be put into the new line alltogether.

Any ideas?
eleanor
 
Posts: 19
Joined: Sat Oct 3rd, 2009

Re: Don't split words on certain letters

Postby Stefan_K on Mon Jul 30th, 2012

Sure, the other ideas I listed above. Perhaps have a look at the links to XeTeX and LuaTeX, to evaluate if it's worth working it out.

Stefan
LaTeX Community Administrator
User avatar
Stefan_K
Site Admin
 
Posts: 6379
Joined: Mon Mar 10th, 2008
Location: Hamburg, Germany

Re: Don't split words on certain letters

Postby localghost on Mon Jul 30th, 2012

eleanor wrote:[…] When running pdflatex test.tex, the third column contains the following text:
Napad na spletno stran z vrinjenjem zlon-
amerne kode, napisane v skriptnem jeziku,
npr. z namenom kraje pikotkov.


Notice that the word "zlonamerne" is splitted on the 'a' boundary. The letter 'a' should not be put into the next line, but should be on the previous line or the word should be put into the new line alltogether. […]

When I compile your example as is, I get the result pictured in the attachment.
Attachments
hyphenation-slovene.png
The obtained output of the provided example.
hyphenation-slovene.png (12.97 KiB) Viewed 611 times
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses
User avatar
localghost
Site Moderator
 
Posts: 9219
Joined: Fri Feb 2nd, 2007
Location: Braunschweig, Germany


Return to Text Formatting

Who is online

Users browsing this forum: No registered users and 9 guests