Text FormattingKomascript full justification

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Pangur
Posts: 29
Joined: Thu Jul 19, 2018 4:47 pm

Komascript full justification

Post by Pangur »

Does anyone know how to make paragraph text fully aligned in Komascript. I want text to be flush on both right and left. I am not interest in anything that ends up with ragged right, nor with ragged left.
Last edited by Pangur on Thu Jul 19, 2018 11:50 pm, edited 1 time in total.

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

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Komascript full justification

Post by Stefan Kottwitz »

Full justification, both left and right, is the default. Take a look (click on "Open in Overleaf" if you like).

Code: Select all

\documentclass{scrartcl}
\usepackage{blindtext}
\begin{document}
\section{Test}
\blindtext
\end{document}
You may have a (perhaps implicit) \raggedright in the code that disables the justification.

Stefan
LaTeX.org admin
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Komascript full justification

Post by Johannes_B »

It could also be possible that you used \centering on the titlepage without proper grouping.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Pangur
Posts: 29
Joined: Thu Jul 19, 2018 4:47 pm

Komascript full justificstion

Post by Pangur »

Thanks, Stefan. That must be why when I looked in the Manual, it gave every option but that the default.

Thanks, again.
Pangur
Posts: 29
Joined: Thu Jul 19, 2018 4:47 pm

Komascript full justificstion

Post by Pangur »

Thanks, Johannes_B.

I think I had a centering left over from my front cover/ title page.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Komascript full justification

Post by Stefan Kottwitz »

Yes, have a \centering always within curly braces { ... } or within an environment. An environment, such as figure or table, limits the effect of this command (any local command). Or one can use \begin{center} ... \end{center} for centered text such as on the title page,

Stefan
LaTeX.org admin
Pangur
Posts: 29
Joined: Thu Jul 19, 2018 4:47 pm

Komascript full justificstion

Post by Pangur »

I had the package ragged2e but commented out. I removed it altogether. There were still bits of the text sticking into the right margin, and other parts not even reaching the margin. I decided to use \sloppy, which gave me exactly what I was looking for. I am hoping that there is no real drawback to this.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Komascript full justification

Post by Stefan Kottwitz »

\sloppy can fix it, though it may have a drawback that some inter word spaces may become to big with such enforced justification.

There are ways to improve justification:

Code: Select all

\usepackage[english]{babel}% or choose your language
\usepackage[T1]{fontenc}% important for hyphenation of words with accents
\usepackage{microtype}% optimized justification via improved microtypography on character level
And if you use default standard fonts Computer Modern (PDF font can become blurry with the default font with T1 encoding), I would switch to Latin Modern (similar but improved):

Code: Select all

\usepackage{lmodern}
If you try this instead of \sloppy, does it get better already?

Stefan
LaTeX.org admin
Pangur
Posts: 29
Joined: Thu Jul 19, 2018 4:47 pm

Komascript full justification

Post by Pangur »

Stefan Kottwitz wrote:

Code: Select all

\usepackage[english]{babel}% or choose your language
\usepackage[T1]{fontenc}% important for hyphenation of words with accents
\usepackage{microtype}% optimized justification via improved microtypography on character level

Code: Select all

\usepackage{lmodern}
If you try this instead of \sloppy, does it get better already?
Stefan
I was using babel and fontenc already, but I added microtype and lmodern instead of \sloppy, and the justification became really good. I did not like the faint lmodern as it is not so good easy reading for public speaking. The font that I was using was sorceanspro. However, i am going through a few to find one that makes good contrasts between bold and normal, etc.
Thanks for the tip. I shall try to use \sloppy sparingly, and concentrate on finding a font that works for my purposes instead. That way, I might not need \sloppy at all. Thanks for your advice.
Pangur
Posts: 29
Joined: Thu Jul 19, 2018 4:47 pm

Komascript full justification

Post by Pangur »

Tried several different fonts now, without \sloppy but with microtype. Works like it should! Thanks, Stefan :)
Post Reply