2

Let's say we have following code:

\documentclass[a4paper,14pt,final,draft]{extreport}
\usepackage[left=3cm,top=2.0cm,right=1.5cm,bottom=2.7cm]{geometry}
\usepackage{changepage}
\usepackage[none]{hyphenat}
\usepackage{showframe}
\usepackage{ragged2e}
\justifying

\begin{document}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummyy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
\end{document}

Expected output: enter image description here

Actual output: enter image description here

I've spent few hours on it and I still can't figure out how do I actually do justify text in a way like LibreOffice Writer does it.

8
  • You're disabling hyphenation: why?
    – egreg
    Commented Feb 18, 2015 at 22:25
  • \input{macro_glob} just generates and error and seems not to be needed. It is normal for paragraphs to start with an indentation, and as you have prevented hyphenation, tex can not justify the lines to the specified width. Commented Feb 18, 2015 at 22:27
  • I have to maintain certain format for the text, which forces me to avoid it. So I'm searching for a way to justify text, as Libre, or MS office does : to adds some extra spaces to the first line and move it's last word to the second line.
    – Roman
    Commented Feb 18, 2015 at 22:33
  • If you really want no hyphenation add \sloppy which tells latex to give up its normal standards and over-stretch interword white space. But don't do that:-) Commented Feb 18, 2015 at 22:36
  • David Carlisle, THANKS A LOT! Add it to your answer. I'll accept it. Yes, I know it's not how normal text should look like, but that's how my report must look like((
    – Roman
    Commented Feb 18, 2015 at 22:40

1 Answer 1

6

Justified paragraphs are normally set with indentation and hyphenation using a suitable set of hyphenation patterns:

enter image description here

\documentclass[a4paper,14pt,final,draft]{extreport}
\usepackage[left=3cm,top=2.0cm,right=1.5cm,bottom=2.7cm]{geometry}
\usepackage{changepage}
%\usepackage[none]{hyphenat}
\usepackage{showframe}
\usepackage{ragged2e}
\usepackage[latin]{babel}


\begin{document}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummyy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
\end{document}

The amount of indentation is set by for example

\setlength\parindent{0pt}

which will make no indent, or you could look at the parskip package.

If you really want no hyphenation add \sloppy which tells latex to give up its normal standards and over-stretch interword white space. But don't do that:-)

You must log in to answer this question.

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