1

tex code as below.

\documentclass[a4paper,11pt,number]{elsarticle} 
\usepackage{times}%Use Times New Roman Font 
\usepackage[hyphens]{url} %To recognize URLs 
\begin{document} 
\title{Integrated Model for Power Interruption Contracts} 
\author{Lakshmi Palaparambil Dinesh} 
\begingroup %\raggedright 
\bibliography{reference_PowerInterruption} 
%\bibliographystyle{apalike} 
\bibliographystyle{elsarticle-num} 
\endgroup 
\end{document}

I see spaces between words or parts of the url with some white spaces after using hyphens with the url package. How to remove the remaning additional white spaces?

enter image description here

  • Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – user36296 Oct 19 '16 at 21:49
  • I tried to introduce linebreaks in your code sample, can you please check if they are at the correct places? – user36296 Oct 19 '16 at 21:50
  • 1
    Can you try this tex.stackexchange.com/a/49791/36296 answer? – user36296 Oct 19 '16 at 21:51
  • 1
    Are you asking why the lines are not justified? – StrongBad Oct 20 '16 at 15:24
  • 1
    What spaces? Remember that the url font is 'mono spaced', which means that each character, no matter how 'little' is designed to take up the same amount of space. An m is as wide as a .. Compare on separate lines (in a mono spaced font) mmm, .m., m.m, i/1. – jon Oct 20 '16 at 20:53
1

Because you gave us no bib file I created one for testing.

Please see the following MWE (package filecontents is only used to have bib file and tex code together in one compilable MWE):

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{Goossens,
  author    = {Goossens, Michel and Mittelbach, Frank and 
               Samarin, Alexander},
  title     = {The LaTeX Companion},
  edition   = {1},
  publisher = {Addison-Wesley},
  location  = {Reading, Mass.},
  year      = {1994},
}
@Book{adams,
  title     = {The Restaurant at the End of the Universe},
  author    = {Douglas Adams},
  series    = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year      = {1980},
}
@article{feynman,
  title     = {Very High-Energy Collisions of Hadrons},
  author    = {Richard P. Feynman},
  journal   = {Phys. Rev. Lett.},
  volume    = {23},
  issue     = {24},
  pages     = {1415--1417},
  year      = {1969},
  month     = {Dec},
  doi       = {10.1103/PhysRevLett.23.1415},
  url       = {http://link.aps.org/doi/10.1103/PhysRevLett.23.1415},
  publisher = {American Physical Society},
}
@article{einstein,
  author  = {Albert Einstein},
  title   = {{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
             [{On} the electrodynamics of moving bodies]},
  journal = {Annalen der Physik},
  volume  = {322},
  number  = {10},
  pages   = {891--921},
  year    = {1905},
  DOI     = {http://dx.doi.org/10.1002/andp.19053221004},
}
@Article{Schamb2010,
  Title      = {Properties of the Distant Kuiper Belt: Results from the
                Palomar Distant Solar System Survey},
  Author     = {(Megan E.) Schwamb and (Michael E.) Brown and
                (David L.) Rabinowitz and Darin Ragozzine},
  Journal    = {The Astrophysical Journal},
  Year       = {2010},
  Month      = {September},
  Number     = {2},
  Pages      = {17},
  Volume     = {720},
  Doi        = {10.1088/0004-637X/720/2/1691},
  Timestamp  = {2014.09.21},
  Url        = {http://m.iopscience.iop.org/0004-637X/720/2/1691/pdf/0004-637X\_720\_2\_1691.pdf}
}
\end{filecontents*}


\documentclass[a4paper,11pt,number]{elsarticle} 

\usepackage{showframe}    % to visualise the typing area and margins
\usepackage{times}        % Use Times New Roman Font 
\usepackage[hyphens]{url} % To recognize URLs 
\usepackage{ragged2e}     % command \RaggedRight

\begin{document}

\title{Integrated Model for Power Interruption Contracts} 
\author{Lakshmi Palaparambil Dinesh} 

This is text with \cite{Goossens, einstein} and \cite{adams}.
\nocite{*} % to test all bib entrys

{
%\RaggedRight % <===================================================
\bibliographystyle{elsarticle-num} % apalike
\bibliography{\jobname} 
}

\end{document}

you get the following result:

resulting pdf

I marked the resulting white space you do not want with red rules ... The most elegant way I knew to get rid of them is to use package ragged2e, which gives you command \RaggdRight to get left justified text with better hyphenation! Please uncomment \RaggdRight in the MWE (see marking <=======) and recompile.

The result you get is now:

enter image description here

The red arrows marks the layout changings. For me that solution is much more better than the first ...

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.