📜 ⬆️ ⬇️

The complication of life in LaTeX

With the imposition of the thesis in LaTeX, the stage has come to bring its type in compliance with at least some accepted standards. Accordingly, the search for a solution to the emerging issues, including standard means, that is, by googling, began.

The first thought that arose after reviewing the solutions found in mixed forums was “I won’t fall asleep.” A little reflection and quick scrolling of the notorious guides of Baldin, Syutkin and Lvovsky, which confirmed the results of reflections, made it possible to deal with questions in much more compact, convenient and perceptible ways.

And examples of how best not to do, I will give two. Honestly, they are very pleased, because testify to the ingenuity and vigor of their creators.
')
Objective : get headings without hyphenation of words, completely aligned to the left.
Source : mix_mix from dxdy.ru

%      . \newcommand{\MTKPsectAlignLeft}{% \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip% \leftskip\z@skip} %    \newcommand{\MTKPsectAlignCenter}{% \let\\\@centercr \rightskip\@flushglue\leftskip\@flushglue \parindent\z@\parfillskip\z@skip} %    \newcommand{\MTKPsectionAlign}{\MTKPsectAlignLeft} \newcommand{\MTKPsubsectionAlign}{\MTKPsectAlignLeft} \newcommand{\MTKPsubsubsectionAlign}{\MTKPsectAlignLeft} %        \newcommand{\MTKPsectAlign}[2]{% \expandafter\renewcommand\csname\string MTKP#1Align\endcsname{% \@nameuse{MTKPsectAlign#2}}} %   \newcommand{\MTKPsectionStyle}{\normalfont\MTKPfontXXVIsize\it\MakeUppercase} % , luitzen \renewcommand\section{\clearpage\@startsection {section}{1}{.em}% {-15mm \@plus -3mm \@minus -2mm}% {15mm \@plus 1mm \@minus 2mm}% {\let\@hangfrom\@empty \MTKPsectionAlign\MTKPsectionStyle}} %    . %  \chapter{--}      \newcommand\chapter{ \begingroup\clearpage\MTKPsectAlign{subsection}{Center}% \subsection*{#1}% \addcontentsline{toc}{section}{#1}\endgroup} 


Local solution:
 \section[  ]{\raggedright  \\  } 


Task : to get headings without hyphenation, with upper case in the text and without it - in the content.
Source : alex__, from gentoo.ru

 \makeatletter \renewcommand{\l@section}{\@dottedtocline{1}{0.4cm}{0.4cm}} \renewcommand{\thesection}{\arabic{section}} \renewcommand{\section}{\@startsection{section}{1}{1.25cm}{-3.5ex plus -1ex minus -.2ex}{2.3ex plus.2ex}{\raggedright\normalfont\bfseries}} \makeatother %  \makeatletter \renewcommand{\l@subsection}{\@dottedtocline{2}{0.8cm}{0.8cm}} \renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}} \renewcommand{\subsection}{\@startsection{subsection}{2}{1.25cm}{-3.5ex plus -1ex minus -.2ex}{2.3ex plus.2ex}{\raggedright\normalfont\bfseries}} \makeatother % - \makeatletter \renewcommand{\thesubsubsection}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}} \renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{1.25cm}{-3.5ex plus -1ex minus -.2ex}{2.3ex plus.2ex}{\raggedright\normalfont}} \makeatother \makeatletter \newcommand{\Section}[1]{ \refstepcounter{section} \section*{\MakeTextUppercase{\arabic{section} #1}} \addcontentsline{toc}{section}{\arabic{section} #1} } \makeatother 


Local solution:
 \section[  ]{  \\  } 


Both solutions, of course, can be converted into global macros, if desired, which will suffice once to include in the preamble of the document, but this will also be a fuss and waste of time. In addition, it’s not a fact that your macro will not be able to correctly process your headers precisely due to the presence in them of any tricky moments in the form of, say, Greek letters or, not to the night, be remembered, mathematical expressions.

Until now, I practically do not understand TeX macros (and the above code clutter is a dark forest altogether), and I always successfully manage with more than standard commands and classes. The only third-party in my miktex and texlive configurations are those PsCyr fonts, and that is not always necessary.

As an analogue of the problem, the eternal balancing between writing own implementations of any algorithms and using ready-made libraries comes to mind. Even the argument that the researcher knows better, what nuances can be formed in his task, and accordingly, his code will take them into account - not always correct. In many libraries, almost everything is already taken into account. The most standard algorithms are so well tested that restrictions on their use go into mathematics, and not into implementation errors.

So, the question. Rhetorical. Why reinvent the wheel, if there are truly elementary to use and debugged funds? Spend the existing potential to solve everyday issues, losing the opportunity to leave it more where it is really needed?

Source: https://habr.com/ru/post/144159/


All Articles