0

I am new to Latex, I apologize for the very basic question in advance.

I just cannot make Latex breake the words correctly, or adjust the spacement of words properly so that I have a straight line at the right of the text, in a "justified" format, a Microsoft Word-user would call.

Instead, I keep getting these "Overfull /hbox" warnings and this awful effect:

Ugly right-side border

I am using the AGU Template in Overleaf.

This piece of codes reproduce the effect. Every single paragraph gets a warning of "Overfull \hbox".

\documentclass[draft]{agujournal2019}
\usepackage{url} 
\usepackage{lineno}
\usepackage[inline]{trackchanges} 
\usepackage{soul}
\linenumbers
\draftfalse
\journalname{Enter journal name here}

\begin{document}

\title{=enter title here=}
\authors{=list all authors here=}
\affiliation{=number=}{=Affiliation Address=}
\correspondingauthor{=name=}{=email address=}

\section{My Section}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod, purus quis fringilla vulputate, enim metus placerat urna, id varius tortor justo ac leo. Donec a euismod felis. 

Nulla venenatis lectus convallis pretium auctor. Phasellus tincidunt lorem quis lacus aliquam, ut fringilla dui pharetra. Quisque imperdiet metus sem, sit amet semper mauris sollicitudin quis. 

Vestibulum tortor urna, porttitor sit amet accumsan vitae, faucibus mattis velit. Aliquam mi dolor, vehicula sit amet nunc venenatis, efficitur ultricies eros.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec facilisis vitae turpis ac ornare. Nulla sollicitudin, nunc vehicula vehicula finibus, nulla enim facilisis leo, id rutrum massa nulla ut magna. Sed cursus tincidunt elit, vulputate placerat nisl eleifend eu. Pellentesque venenatis justo ante. Cras eget ullamcorper lectus. 

In fermentum fringilla porta. Praesent porta, ipsum nec ultrices porta, elit tortor eleifend ligula, ut sodales urna libero ac lectus. In nec nisl eu eros fermentum consectetur. 

Sed sodales massa at elit tincidunt consequat. Donec euismod facilisis mattis. Morbi semper lectus at condimentum convallis. Donec condimentum libero quis velit maximus malesuada. Quisque fermentum tristique venenatis. Pellentesque nec libero augue.

\acknowledgments
Enter acknowledgments, including your data availability statement, here.

\bibliography{ enter your bibtex bibliography filename here }

\end{document}

A full (all auxiliary files) reproducible example is available here.

Thank you for your advice.

  • 3
    please show a small example, the output that you show looks like \RaggedRight from the ragged2e package, the default settings would never produce that layout. – David Carlisle May 16 '19 at 13:37
  • I added a link to a shared project in Overleaf, where anyone can have access through the link provided. – David Nielsen May 16 '19 at 14:22
  • I found it difficutl to show a "small example", because the problem is in a ready template, so I cannot know exactely where it comes from. Thus, I edited the question sharing a project example in Overleaf where this is reproduced. – David Nielsen May 16 '19 at 14:23
  • 1
    Please make examples inline here on this site (the question is archived forever and will not be understandable if the link breaks) If you really can not, at least make the external link not require an account at the other site. – David Carlisle May 16 '19 at 14:24
  • Done. I inserted a piece of the .tex file, and a link to a Dropbox folder where everything can be downloaded, since there are some .sty and .cls files in the project too. – David Nielsen May 16 '19 at 14:41
2

As I guessed from the image as posted in the original question, the class file has

%% \RaggedRight makes the right margin go in and out; if this is commented out
%% the default will be a right justified margin.
\RequirePackage{ragged2e}
\RaggedRightParindent=24pt
\advance\RaggedRightRightskip 24pt
\RaggedRight

So by design the right margin is ragged. You could of course disable this (comment out the last line for example) but the whole point of a journal class is to remove style choice from the author and enforce the journal house style.

  • I understand your point, and that solves the problem. Would there be a way to keep the journal house style, and at the same time get rid of all the warnings? They are so annoying. – David Nielsen May 16 '19 at 14:55
  • 1
    @ouranos the warnings are specific to your text, I didn't download all the files, just looked at the class file source. The example in the image is trying to hyphenate mock latin text with american english hyphenation rules, so bad line breaks and warnings are expected. You can turn off the warnings, see tex.stackexchange.com/questions/50830/… – David Carlisle May 16 '19 at 15:24
  • I get all the warnings using English as well. Thanks for the explanation. Seems like the forced style brings the warnings. – David Nielsen May 16 '19 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.