4

There have been already several questions on this point, but still I could not find what I am looking for. I am working with book class and compiling tex file with LuaLaTeX engine. The packages babel, fontspec are also loaded. I am looking for

  1. Justification of paragraph text like in Microsoft word. The lengthier space between words is okay like it is done in Microsoft word.
  2. No hyphenation for entire content of the book.
  3. Uniform spacing between sections, subsections, paragraphs etc.

What I have tried so far is this.

  1. Setting \hyphenpenalty to 1000. It causes extra white-space between sections, subsections, paragraphs etc.

  2. \usepackage[none]{hyphenat} This causes words going out of margins. I am using geometry package with custom margins.

  3. \usepackage[none]{hyphenat} with \sloppy macro. It causes extra white-space between sections, subsections, paragraphs etc.

  4. \usepackage[english=nohyphenation]{hyphsubst} also does not work.

The following is the MWE. The overleaf link.

\documentclass[fontsize=12bp,twoside,a4paper]{book}
\usepackage{fontspec,blindtext,setspace,scrextend,longtable,booktabs}
\hyphenpenalty=10000
\usepackage[hmargin=2.54cm,vmargin=2.54cm]{geometry}
\setmainfont{Times New Roman}
\setstretch{1.42}
\begin{document}

\chapter{Test}
some text some text some text


    \begin{longtable}{ccp{12cm}}
    \toprule[1.2pt]
    \textbf{A} & \textbf{B} & \textbf{C} \\
    \midrule
    a & b & \blindtext \\ \midrule
    a & b & \blindtext \\ 
    \bottomrule[1.5pt]
    \caption{Some Caption}
    \label{tbl:sometbl}
    \end{longtable}
    
    \blindtext[2]
    
    \subsection{Some Section}  \blindtext
    
    \subsection{Some Section}  \blindtext
    \end{document}

I have also attached the screenshot of some part of second page. enter image description hereI understand the fact that it may not be in the spirit of LaTeX to do some ugly formatting. However, sometimes we have these requirements posed by the institute or some journal. The problem is to have justified text in paragraph like Microsoft word and no hyphenation. Any help would be quite helpful. Thank You.

8
  • 3
    Apart from the hyphenation, I find the other requests here a bit unclear. In particular, what do you mean by “Justification of paragraph text like in Microsoft word.” — what difference(s) between LaTeX’s normal justification and Word’s do you have in mind? Commented May 10, 2023 at 6:04
  • 2
    Please, describe more precisely, what does mean "Justification of paragraph text like in Microsoft word".
    – wipet
    Commented May 10, 2023 at 6:23
  • 2
    points 1 and 3 are wrong they do not affect vertical space, point 4 is not clear enough to comment on. please provide a small but complete example Commented May 10, 2023 at 6:24
  • 4
    The easiest way "to have justified text in paragraph like Microsoft word" is to use Microsoft Word. (La)TeX uses a far superior justification algorithm. Commented May 10, 2023 at 6:35
  • 3
    You could try the (quite old) package wordlike. From the description: The package aims at making life easier for users who are discontent with LaTeX's standard layout settings because they need a layout that resembles the usual “wordlike” output. Commented May 10, 2023 at 6:47

2 Answers 2

9

If you disable hyphenation then naturally you will not get publication quality typesetting, but you can make some adjustments to compensate.

Add \sloppy to allow horizontal white space to stretch more, and add microtype to enable micro adjustments to character widths to reduce the amount of white space stretching needed.

The vertical space issues are unrelated, you can add \raggedbottom so any excess vertical space does not cause spaces mid-page to stretch.

enter image description here

2

I will try to address the particular issues that the person is experiencing. LaTeX can be challenging for new users.

No hyphenation for entire content of the book.

You can discourage the hyphenation of words at the end of a line via \hyphenpenalty. The maximum penalty is 10000 so \hyphenpenalty=10000 would prevent almost every hyphen. Of course, the spaces between words may have to be stretched more in compensation so this would likely require a larger value for tolerance or emergencystretch.

Uniform spacing between sections, subsections, paragraphs etc.

The standard way to adjust spacing between headings is the titlesec package. Overleaf has pretty good documentation for this:
https://www.overleaf.com/learn/latex/Sections_and_chapters
The standard way to adjust spacing between paragraphs is the parskip package. For example, \usepackage[skip=6pt]{parskip} would insert 6pts of empty space between paragraphs. Also if you want "uniform spacing" you need to use \raggedbottom instead of the default \flushbottom.

\usepackage[none]{hyphenat} This causes words going out of margins. I am using geometry package with custom margins.

If words are sticking into the margins, it means La(TeX) cannot justify the text with the given parameters without causing typographic issues that are too severe. The philosophy of TeX is that the user should fix this via reformatting, rewriting, hyphenation (I know you said you don't want this for this project), tolerance, and other parameters listed here:
What is the meaning of \fussy, \sloppy, \emergencystretch, \tolerance, \hbadness?

1
  • 1
    Based on your answer, I tried to create MWE (added in the question). I am unable to find what causes the issue.
    – user61681
    Commented May 10, 2023 at 8:11

You must log in to answer this question.

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