Ajuste de línea en TOC/LOF

Ajuste de línea en TOC/LOF

En mi TOC y LOF, los elementos deben ajustarse de modo que la palabra alcance el margen derecho y evite los espacios antes de pasar a una nueva línea y luego la nueva línea comience exactamente donde comienza la primera línea. (Mira lo que obtuve en el látex)

Mi salida de látex

Estas son las partes completas de mi archivo de estilo; (clase de informe)

%%
%%
%%
\typeout{Thesis style for IGSR Mediterranean University, Version 1.0}
%
% Definitions for title and approval pages
%
\def\degree#1{\gdef\@degree{#1}}
%\def\program#1{\gdef\@program{#1}}
\def\Dept#1{\gdef\@Dept{#1}}
\def\subyear#1{\gdef\@subyear{#1}}
\def\InstituteDirector#1{\gdef\@InstituteDirector{#1}}
\def\DeptChair#1{\gdef\@DeptChair{#1}}
\def\cosuperi#1{\gdef\@cosuperi{#1}}
\def\cosuperii#1{\gdef\@cosuperii{#1}}
\def\examineri#1{\gdef\@examineri{#1}}
\def\examinerii#1{\gdef\@examinerii{#1}}
\def\supervisor#1{\gdef\@supervisor{#1}}
\def\examineriii#1{\gdef\@examineriii{#1}}
\def\examineriv#1{\gdef\@examineriv{#1}}
\def\examinerv#1{\gdef\@examinerv{#1}}
\def\dateofapproval#1{\gdef\@dateofapproval{#1}}
%
\global\let\@degree\empty
%\global\let\@program\empty
\global\let\@Dept\empty
\global\let\@InstituteDirector\empty
\global\let\@DeptChair\empty
\global\let\@cosuperi\empty
\global\let\@cosuperii\empty
\global\let\@examineri\empty
\global\let\@examinerii\empty
\global\let\@supervisor\empty
\global\let\@examineriii\empty
\global\let\@examineriv\empty
\global\let\@examinerv\empty
\global\let\@examinervi\empty
\global\let\@dateofapproval\empty
\def\nyear{\number\year}
\def\nmonth{\number\month}
\global\let\@subyear\nyear
\global\let\@submonth\nmonth
%
% Other definitions
%
\xdef\@singlespaced{1}
\xdef\@onehalfspaced{1.5}
%
\newlength{\insd}
\newlength{\dc}
\newlength{\dpt}
\newlength{\spv}
\newlength{\ei}
\newlength{\csi}
\newlength{\csii}
\newlength{\eii}
\newlength{\eiii}
\newlength{\eiv}
\newlength{\ev}
\let\@app\empty
\newcounter{thsfootcnt}
%
% Title page
%
\newcommand\uptitle{
  \ifx\@degree\empty \@@warning{No \string\degree\space given} \fi
  \null
  \vspace*{-45pt}
  \let\baselinestretch\@singlespaced{\fontsize{18.3}{1}{\textbf{\@title}} \\% %title font size
  \vskip 160pt                                                   %distance between title and author
  \fontsize{16.4}{1}{\textbf{\@author}} \\ %Author font size
  \vskip 110pt
  \large{Submitted to the\\Institute of Graduate Studies and Research\\            %%\large with the document class of 12pt corresponds to fontsize 14.4
  in partial fulfillment of the requirements for the degree of} \\[120pt]}}
%\vskip 200pt
\newcommand\downtitle{
\vskip 120pt
 %\vskip 2\baselineskip
\let\baselinestretch\@singlespaced{
\vskip 00pt
  \large{Eastern Mediterranean University} \\ \large{August 2017}}\\[1pt] \large{Gazimagusa, North Cyprus}
  \null}
%
\newcommand\relaxtitlestuff{
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax}
%
\newcommand\makemstitle{\begin{titlepage}
   \let\baselinestretch\@singlespaced{
   \begin{center}
   \uptitle
   \vskip 56pt
   \large{Master of Science \\ in \\ \@Dept}
   \downtitle
   \end{center}}
   \end{titlepage}
   \relaxtitlestuff}
%

\newcommand\makephdtitle{\begin{titlepage}
   \begin{center}
   \uptitle
   \large{Doctor of Philosophy} \\% \vspace{-0.5cm}
   \large{in}\\ %\vspace{-0.5cm}
   \large{\@Dept}
   \downtitle
   \end{center}
   \end{titlepage}
   \relaxtitlestuff}
%
% Approval page
%
\newcommand\makeapprovalpage{%
  \addtocounter{page}{-1}
  \settowidth{\insd}{\@InstituteDirector}
  \settowidth{\dc}{\@DeptChair}
  \settowidth{\dpt}{\@Dept}
  \settowidth{\ei}{\@examineri}
  \settowidth{\csi}{\@cosuperi}
  \settowidth{\csii}{\@cosuperii}
  \settowidth{\eii}{\@examinerii}
  \settowidth{\spv}{\@supervisor}
  \settowidth{\eiii}{\@examineriii}
  \settowidth{\eiv}{\@examineriv}
  \settowidth{\ev}{\@examinerv}
  \ifdim\ei>\spv \spv\ei \fi
  \ifdim\csii>\spv \spv\ei \fi
  \ifdim\eii>\spv \spv\eii \fi
  \ifdim\csi>\spv \spv\ei \fi
  \ifdim\eiii>\spv \spv\eiii \fi
  \ifdim\eiv>\spv \spv\eiv \fi
  \ifdim\ev>\spv \spv\ev \fi
  \vspace*{-1.6cm}
  \hspace{-0.5cm}Approval of the Institute of Graduate Studies and Research
  \vspace*{1cm}
  \begin{tabbing}
  \hspace*{3.0cm} \= \hspace*{\spv}\hspace*{1em} \= \kill
  \ifx\@InstituteDirector\empty \ifx\@cosuperi\empty \ifx\@cosuperi\empty
     \@@warning{No \string\InstituteDirector\space given} \fi \fi
  \else \hspace*{8.cm}\makebox[60mm]\hrulefill\> \\[-16pt]\hspace*{8.5cm}\@InstituteDirector \>  \\[-16pt]
     \>\hspace*{7.5cm} Director \\\\ \> \fi
  \hspace{-3.1cm}\vspace*{6cm}I certify that this thesis satisfies the requirements as a
  thesis for the degree of Doctor\\[-12pt]
  of Philosophy in \@Dept.\\[1cm]
  \vspace*{-0.5cm}
  \ifx\@supervisor\empty \ifx\@cosuperi\empty \ifx\@cosuperi\empty
     \@@warning{No \string\supervisor\space given} \fi \fi
  \else \hspace*{7.9cm}\makebox[60mm]\hrulefill\> \\[-16pt]\hspace*{8.3cm}\@DeptChair\>  \\[-16pt]
     \>\hspace*{4.8cm} Chair, Department of Electrical and\>\\[-16pt]                                                                               %\hspace value can be change to change the position of expression"Electrical Engineering"
     \>\hspace*{5.8cm} Electronic Engineering\\[1cm]\> \fi
  \hspace{-3.1cm}We certify that we have read this thesis and that in our opinion it is fully adequate,\\[-12pt]
  in scope and quality as a thesis of the degree of Doctor of Philosophy in Electrical \\[-12pt]
 and Electronic Engineering.\\[1cm]

  \ifx\@supervisor\empty \else \hspace*{8.1cm}\makebox[60mm]\hrulefill\> \\[-16pt]\hspace*{9cm}\@supervisor \> \\[-16pt]
     \>\hspace*{7cm} Supervisor  \> \\[-1.9cm]

  \hspace*{-0.0cm}\makebox[60mm]\hrulefill\> \\[-16pt]\hspace*{0.90cm}\@cosuperi \>
  \\[-16pt]
     \>\hspace*{-1.5cm} Cosupervisor \\ \>\\\\\fi
  \hspace*{10cm}Examining Committee\\*[-24pt]
  \makebox[14cm]\hrulefill\\

  \ifx\@examineri\empty \else   1. \@examineri \>   \hspace*{5cm}\makebox[60mm]\hrulefill \\ \fi
  \ifx\@examinerii\empty \else  2. \@examinerii \>  \hspace*{5cm}\makebox[60mm]\hrulefill\\ \fi
  \ifx\@examineriii\empty \else 3. \@examineriii \> \hspace*{5cm}\makebox[60mm]\hrulefill\\ \fi
  4. \@supervisor \> \hspace*{5cm}\makebox[60mm]\hrulefill \\
  \ifx\@examineriv\empty \else  5. \@examineriv \>  \hspace*{5cm}\makebox[60mm]\hrulefill\\ \fi
  \end{tabbing}
  \vfill
  %\vspace*{2cm}
%\global\let\@title\@empty
%\global\let\title\relax
\global\let\@dateofapproval\@empty
\global\let\dateofapproval\relax
\global\let\@supervisor\@empty
\global\let\supervisor\relax
\global\let\@cosuperi\@empty
\global\let\cosuperi\relax
\global\let\@cosuperii\@empty
\global\let\cosuperii\relax
\global\let\@examineri\@empty
\global\let\examineri\relax
\global\let\@examinerii\@empty
\global\let\examinerii\relax
\global\let\@examineriii\@empty
\global\let\examinerii\relax
\global\let\@examinervi\@empty
\global\let\examinervi\relax
\global\let\@examinerv\@empty
\global\let\examinerv\relax
}
%
% Abstract, Acknowledgements, Oz, etc.
%

\newenvironment{preface}{\chapter*{\prefacename}}
   {\par\vfil\null}
%
\newenvironment{foreword}{\chapter*{\forewordname}}
   {\par\vfil\null}

%************************* ABSTRACT TITLE ***********************

\renewenvironment{abstract}{\chapter*{\abstractname }
\begin{center}
%{\LARGE\abstractname}}
{\textbf{}}\end{center}}
   {\par\vfil\null}

\newenvironment{acknowledgements}{\chapter*{\ackname}}
   {\par\vfil\null}
%
\newenvironment{ozet}{\chapter*{\ozetname }
\vspace{-0.cm}
\begin{center}{\large \textbf{}}\end{center}}
   {\par\vfil\null}
%
\newenvironment{symbols}{%
   \clearpage
   \chapter*{\listsymbolname}
   \beginsymlist}
  {\closesymlist}
%
\newcommand{\beginsymlist}{%
   \begin{tabbing}
   \hspace*{\symtabi}\=\hspace*{\symtabii}\=\kill}
%
\newcommand{\closesymlist}{\end{tabbing}}
%
\newcommand{\sym}[2]{\>#1 \>#2 \\}
\newlength{\symtabi}
\newlength{\symtabii}
\setlength{\symtabi}{1em}
\setlength{\symtabii}{10em}
%
\newcommand\prefacename{\vskip-0.2cm \hskip -0.65cm\fontsize{16}{1} \textbf{ PREFACE}}                                                            
\newcommand\forewordname{\vskip-0.2cm \hskip -0.65cm \fontsize{16.5}{1} \textbf{ APPENDICES}}
\newcommand\ackname{\vskip-0.2cm \hskip -0.65cm \fontsize{16.5}{1}  \textbf{ACKNOWLEDGMENT}}
\newcommand\ozetname{\vskip-0.2cm \hskip -0.65cm \fontsize{16.5}{1}  \textbf{\"OZ}}
\newcommand{\listsymbolname}{\vskip-0.2cm \hskip -0.65cm\fontsize{16.5}{1}   \textbf{LIST OF SYMBOLS}}
%\renewcommand\indexname{\vskip-0.5cm \hskip -0.65cm\fontsize{16}{1}   \textbf{INDEX}}
\renewcommand\partname{\vskip-0.5cm \hskip -0.65cm  \fontsize{16}{1}  \textbf{PART}}
\renewcommand\appendixname{\vskip-0.2cm \hskip -0.65cm \fontsize{16.5}{1}  \textbf{APPENDIX}}
\renewcommand\abstractname{\vskip-0.2cm \hskip -0.65cm  \fontsize{16.5}{1}  \textbf{ABSTRACT}}
%
% Sectional Units
%
\renewcommand\chapter{\clearpage
                    \global\@topnum\z@
                    \@afterindenttrue
                    \secdef\@chapter\@schapter}
%
\renewcommand\@makechapterhead[1]{\begin{center}
  {\fontsize{16}{1}
    \ifnum \c@secnumdepth >\m@ne
    \ifx\@app\empty
        \vspace*{-0.8cm} \bfseries Chapter \hspace{0.5ex}\arabic{chapter} \\[0.95cm]    %this line is used to set the chapter head margin in the first \vspace(i did \vspace{-1.98} corresponds to 3.5 cm top margin) and and the end of line\\[cm] is used to set the indent between chapter head and title that should be 24 pt which is aproximately 0.65cm  after indent \\
        %\large\bfseries \hspace{1ex}
    \else
        \vspace*{-0.5cm}\large\bfseries \appendixname\ \thechapter.\hspace{1ex}
    \fi
    \fi
    \interlinepenalty\@M
    \large \bfseries #1\par\nobreak
    \vskip\baselineskip
  }\end{center}}
%
\renewcommand\@makeschapterhead[1]{\begin{center}
  { \normalfont
    \interlinepenalty\@M
    \vspace*{-1.5cm}\large \bfseries #1\par\nobreak                                %fo
    \vskip\baselineskip
  }\end{center}}
%
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                      \refstepcounter{chapter}%
                      \typeout{\@chapapp\space\thechapter}%
                      \ifx\@app\empty
                        \addcontentsline{toc}{chapter}%
                            {\protect\numberline{\chaptocapp}#1}%
                      \else
                        \addtocontents{toc}{%
                        \noindent
                        \appendixname\ \thechapter\hspace{1.6ex}#1
                        \nobreak\leaders
                        \hbox{$\m@th \mkern \@dotsep mu\mkern
                              \@dotsep mu$}
                        \hfill \nobreak
                        \hb@xt@\@pnumwidth{\hss \thepage}\par}
                      \fi
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                      \@makechapterhead{#2}%
                      \@afterheading
                   }
%
\renewcommand\@schapter[1]{\addcontentsline{toc}{chapter}{#1}%
     \@makeschapterhead{#1} \@afterheading}
%
\def\chaptocapp{\thechapter}
%
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                    {7pt} %{-3.5ex \@plus -1ex \@minus -.2ex}
                                    {7pt} %{2.3ex \@plus.2ex}%
                                    {\fontsize{14}{1}\raggedright\bfseries\textbf\large}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                    {7pt}%{-3.25ex\@plus -1ex \@minus -.2ex}%
                                    {7pt}%{1.5ex \@plus .2ex}%
                                     {\raggedright\bfseries\textbf\normalsize}}
\renewcommand\subsubsection[1]{\@startsection{subsubsection}{3}{\z@}%
                                     {7pt}%{-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {-0.5em}%
                                     %{-3.25ex\@plus -1ex \@minus -.2ex}%
                                     %{-1em}%
                                     {\normalsize}[#1]{\underbar{#1.}}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%]
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\normalfont\normalsize\itshape}}
%
% There should be a period after the section number.
\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
   \let\@svsec\@empty\else
   \refstepcounter{#1}
   \ifnum#2=3
     \edef\@svsec{\underbar{\csname the#1\endcsname\hskip 0.5em}}
     \else
     \edef\@svsec{\csname the#1\endcsname\hskip 0.5em}\fi
   \fi
   \@tempskipa #5\relax
   \ifdim \@tempskipa>\z@
      \begingroup #6\relax
         \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M #8\par}%
      \endgroup
      \csname #1mark\endcsname{#7}
      \addcontentsline{toc}{#1}
         {\ifnum #2>\c@secnumdepth
          \else \protect\numberline{\csname the#1\endcsname}
          \fi
          #7}
   \else
      \def\@svsechd{#6\hskip #3\relax  %% \relax added 2 May 90
         \@svsec #8\ifnum #2>\c@secnumdepth.\fi
         \csname #1mark\endcsname{#7}
         \addcontentsline{toc}{#1}
           {\ifnum #2>\c@secnumdepth
            \else \protect\numberline{\csname the#1\endcsname}
            \fi
         #7}}
   \fi
   \@xsect{#5}}
%
% First paragraf of a section should be indented
%\def\@startsection#1#2#3#4#5#6{\if@noskipsec \leavevmode \fi
%   \par \@tempskipa #4\relax
%   \@afterindenttrue
%   \ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \fi
%   \if@nobreak \everypar{}\else
%     \addpenalty{\@secpenalty}\addvspace{\@tempskipa}\fi \@ifstar
%     {\@ssect{#3}{#4}{#5}{#6}}{\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
%
\addtocounter{secnumdepth}{1}
\addtocounter{tocdepth}{1}
%
% Figures and Tables
%
\renewcommand\listfigurename{\vskip 0.85cm \hskip -0.65cm \fontsize{16.5}{1} \textbf{LIST OF FIGURES}}
\renewcommand\listtablename{\vskip 0.85cm \hskip -0.65cm  \fontsize{16.5}{1} \textbf{LIST OF TABLES}}
\renewcommand\figurename{Figure}
\renewcommand\tablename{Table}
%
\renewcommand\listoffigures{% \ev is used for temporary storage of \parskip
\setlength{\baselineskip}{\baselineskip}  % This is where the linespacing is changed in the list of tables. Aykut Hocanin
\setlength{\ev}{\parskip}
\parskip0pt
    \chapter*{\listfigurename
      \@mkboth{\listfigurename}%
              {\listfigurename}}%
    \@starttoc{lof}%
\parskip\ev}

\renewcommand\listoftables{% \ev is used for temporary storage of \parskip
\setlength{\baselineskip}{\baselineskip}
\setlength{\ev}{\parskip}
\parskip0pt
    \chapter*{\listtablename
      \@mkboth{%\vspace{-2cm}
          \MakeUppercase\listtablename}{\listtablename}}%
    \@starttoc{lot}%
\parskip\ev}
%
% The expressions 'FIGURE' and 'TABLE' also appear in the LOF and LOT.
\long\def\@caption#1[#2]#3{\par\addcontentsline{\csname
  ext@#1\endcsname}{#1}{\protect\numberline{
  \csname #1name\endcsname \space
  % This is where the linespacing is changed in the list of tables. Mohammad Ahmad
%  \csname the#1\endcsname .}{\ignorespaces #2}\protect\vspace{\baselineskip}}\begingroup
  \csname the#1\endcsname }{\ignorespaces #2}\protect\vspace{0.3\baselineskip}}\begingroup

    \@parboxrestore
    \normalsize
    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
  \endgroup}
%
% A period should appear after the caption number.
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{#1. #2}%
  \ifdim \wd\@tempboxa >\hsize
    \centering{#1. #2}\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
%

% The lines of LOF and LOT must not be dotted.
\renewcommand\l@figure{\@dottedtocline{1}{0em}{6em}}
\renewcommand\l@table{\@dottedtocline{1}{0em}{5.8em}}
\def\@undottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else
  \vskip \z@ plus.2\p@
  {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
    \parindent #2\relax\@afterindenttrue
   \interlinepenalty\@M
   \leavevmode
   \@tempdima #3\relax \advance\leftskip \@tempdima \hbox{}\hskip -\leftskip
   #4\nobreak\leaders\hbox{}\hfill \nobreak
   \hbox to\@pnumwidth{\hfil\reset@font\rm #5}
 %  \\*[-2cm]
   \par}\fi}


%
% Table of Contents
%


%\renewcommand\contentsname{TABLE OF CONTENTS}
%\renewcommand\tableofcontents{% \ev is used for temporary strage of \parskip
%\setlength{\ev}{\parskip}
%\parskip0pt
%  A line as 'TABLE OF CONTENTS' must not appear in the
% Table of Contents. Hence we reproduce the \chapter* here except that
% no entry is put into the toc file
%     \clearpage  \global\@topnum\z@
%     \@afterindenttrue
%     \@makeschapterhead{\contentsname} \@afterheading
%\@starttoc{toc}%
%\parskip\ev}
%

\renewcommand\contentsname{\vspace{-0.45cm}\fontsize{16.5}{1}\textbf{TABLE OF CONTENTS}\vspace{-1.2cm}}
\renewcommand\tableofcontents{% \ev is used for temporary storage of \parskip
\setlength{\ev}{\parskip}
\parskip0pt
%  A line as 'TABLE OF CONTENTS' must not appear in the
% Table of Contents. Hence we reproduce the \chapter* here except that
% no entry is put into the toc file
     \clearpage\global\@topnum\z@
     \@afterindenttrue
     \begin{center}
      { \normalfont
       \interlinepenalty\@M
       \vspace*{-0.2cm}\large \bfseries  \contentsname\par\nobreak
       \vskip\baselineskip \vskip\baselineskip % *********** bir vskip fazladan koyduk
      }\end{center}
     \@afterheading
     \@starttoc{toc}%
\parskip\ev}


% EMU IGER style TOC does not have bold lines
\renewcommand\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    %EMU IGER style TOC does not have extra space between chapterlines
    \vskip 0.5em \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode % That is what we have to comment out: \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep
       mu$}\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
%
% The spacing of the TOC lines has been redefined.
\renewcommand*\l@section{\@dottedtocline{1}{5em}{2.em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{3.8em}{2.9em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{7em}{3.8em}}
\renewcommand*\l@paragraph{\@dottedtocline{4}{11.1em}{4.7em}}
\renewcommand*\l@subparagraph{\@dottedtocline{5}{16.1em}{5.7em}}
%
% Appendix
%
\renewcommand\appendix{\par
 \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \renewcommand\@chapapp{\appendixname}
  \renewcommand\thechapter{\@Alph\c@chapter}%
  \let\@app1
}
%
% References
%
%\def\@biblabel#1{#1.} % This removes the square brackets AH
%
\newenvironment{harvardbibliography}{\chapter*{\bibname}%
     \begin{list}{}{\topsep0pt \leftmargin2em \rightmargin0pt
     \item indent-2em \item sep\parskip \parsep0pt}}
     {\def\@noitemerr
       {\@latex@warning{Empty `harvardbibliography' environment}}
      \end{list}}
%
\newenvironment{bibnotcited}[1]{\chapter*{\bibncname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `bibnotcited' environment}}%
      \endlist}
%
\newenvironment{harvardbibnotcited}{\chapter*{\bibncname}%
     \begin{list}{}{\topsep0pt \leftmargin2em \rightmargin0pt
     \itemindent-2em \itemsep\parskip \parsep0pt}}
     {\def\@noitemerr
       {\@latex@warning{Empty `harvardbibnotcited' environment}}%
     \end{list}}
\renewcommand{\bibname}{\vskip -0.1cm \hskip -0.65cm \fontsize{16.5}{1}\textbf{ REFERENCES}}
%\newcommand{\bibncname}{\vskip-1.3cm \hskip -0.65cm REFERENCES NOT CITED}
%
% Footnotes are numbered consecutively throughout the
% whole thesis and single line-spacing is invoked
%
\def\footnote#1{%
   \@ifnextchar[{\@xfootnote}{%
\setcounter{footnote}{\value{thsfootcnt}}%
\addtocounter{thsfootcnt}{1}%
   \stepcounter{\@mpfn}%
     \begingroup\let\protect\noexpand
       \xdef\@thefnmark{\thempfn}\endgroup
\let\baselinestretch\@singlespaced
     \@footnotemark\@footnotetext{#1}
\let\baselinestretch\@onehalfspaced}
}
%
% Single line spacing is required in in quotations
%
\renewenvironment{quotation}{%
     \par
     \list{}{%
\let\baselinestretch\@singlespaced
      \listparindent 1.5em%
      \itemindent    \listparindent
      \rightmargin   \leftmargin
      \parsep       \z@ \@plus\p@}%
      \item\relax}
     {\par
\let\baselinestretch\@onehalfspaced
      \endlist}
\renewenvironment{quote}{%
      \par
\let\baselinestretch\@singlespaced
      \list{}{%
       \baselineskip0.67\baselineskip
       \listparindent 1.5em%
       \itemindent\listparindent
       \rightmargin\leftmargin}%
       \item\relax}
     {\par
\let\baselinestretch\@onehalfspaced
      \endlist}
%
% Spacing for displayed formulas (redefine the \normalsize command
% Note: In earlier implementations of LaTeX \@normalsize may need
% to be redefined instead of \normalsize
%
\renewcommand{\normalsize}{\@setsize\normalsize{14.5pt}\xiipt\@xiipt
\abovedisplayskip 20pt %\p@ plus3\p@ minus7\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip  \abovedisplayskip %\z@ plus3\p@
\belowdisplayshortskip  \abovedisplayskip %6.5\p@ plus3.5\p@ minus3\p@
\let\@listi\@listI}
%
% Page style
%
\oddsidemargin 1.6cm
\evensidemargin 2cm
\topmargin -1.3cm
%\headheight20pt
\textwidth 146mm
\textheight 249mm
%\pagestyle{myheadings}
%
% Invoke double spacing
\renewcommand{\baselinestretch}{2}
\setlength{\parskip}{\baselineskip}
%
% This is end of emu_tez.sty

Respuesta1

En realidad, resultó ser relativamente fácil. Tenga en cuenta que si no hay suficiente espacio en la última línea, el número de página se colocará en el margen. Con este fin creé \needhspaceforzar un salto de línea cuando no hay suficiente espacio para el número de página ( \@pnumwidth).

Lo siento, pero eché un vistazo a tu MWE y decidí evitarlo. Todo lo que necesitas hacer es mostrar el problema.

\documentclass{report}
\usepackage{blindtext}% MWE only

\makeatletter
\def\@tocrmarg{0pt}
\newcommand{\needhspace}{\rule{\@pnumwidth}{0pt}\hspace{-\@pnumwidth}\null}
\makeatother

\begin{document}

\tableofcontents

\section{\blindtext}

\section{\rule{\dimexpr\textwidth-3.8em}{1pt}}

\section{\rule{\dimexpr\textwidth-3.8em}{1pt} \needhspace}

\end{document}

manifestación

información relacionada