# Design of the chapterhead and initial letter

I am preparing a document and in the course of this, there are some problems.

1) How can I connect the upper left with the left bottom edge and similarly the right upper and lower right edges in the design of the chapter?

2) At the beginning of each chapter is a initial letter. If the \tableofcontents is arranged in 2 columns, then the text shifts from it to the right. Whether it is possible to avoid it?

If the \tableofcontents is made out in 1 column or if it is inserted in the end of the document this problem does not arise.

3) How to make a sparce text in the title of the chapter (on the screen, and not in the content?

Preamble:

\documentclass[a4paper,12pt,small,openany,twoside]{memoir}
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{misccorr}
\usepackage{cmap}
\frenchspacing

\usepackage{amssymb,amsfonts,amsmath}
\usepackage{cite,float,textcomp,setspace}
\usepackage{txfonts}
\usepackage{paratype}
\usepackage{tikz}
\usepackage{indentfirst}
\usepackage{microtype}
\usepackage[explicit]{titlesec}
\usepackage[dvips]{graphicx,xcolor}
\graphicspath{{grafika/}}
\usepackage{wrapfig}
\usepackage{multicol}

%CHAPTER IN TEXT

\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 0.5ex \hfill \kern \z@}
\def\newrule{\leavevmode \leaders \hrule height 2pt \hfill \kern \z@}

\vspace*{-5\p@}
{\parindent \z@ \centering \reset@font
{\large \bfseries \@chapapp{} \thechapter}
\par\nobreak
\vspace*{10\p@}
\interlinepenalty\@M
\hrule
\vspace*{10\p@}
\huge \bfseries   #1\par\nobreak
\par
\vspace*{-15\p@}
\newrule

\vskip 10\p@
}}

\vspace*{-5\p@}
{\parindent \z@ \centering \reset@font
\thickhrulefill
\par\nobreak
\vspace*{10\p@}
\interlinepenalty\@M
\hrule
\vspace*{10\p@}
\huge \bfseries  #1\par\nobreak
\par
\vspace*{-15\p@}
\newrule

\vskip 10\p@
}}

\makeatother

%%%%%%%%%%%%%%%%%%

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}

\usepackage[paper=a4paper, verbose, centering]{geometry}

\geometry{left=10mm}
\geometry{right=10mm}
\geometry{top=15mm}
\geometry{bottom=15mm}
\pagestyle{plain}

\usepackage{pgfornament}
\usetikzlibrary{chains}

\usepackage{enumitem}
\setlist{nolistsep}
\usepackage{eso-pic}

\AtBeginDocument{\renewcommand\contentsname{\large\textbf{Содержание}}}
\usepackage{titletoc}
\usepackage{lipsum}
\contentsmargin{0cm}

\titlecontents{chapter}[1.25cm]
{\contentslabel[\normalsize\thecontentslabel]{1.5cm}}
{}
{\ \titlerule*[.5pc]{.}\;\thecontentspage}

\titlecontents{section}[1.25cm]
{\contentslabel[\thecontentslabel]{1.5cm}}
{}
{\ \titlerule*[.5pc]{.}\;\thecontentspage}
[]

\titlecontents{subsection}[1.25cm]
{\contentslabel[\thecontentslabel]{1.5cm}}
{}
{\ \titlerule*[.5pc]{.}\;\thecontentspage}
[]

\titlecontents{subsubsection}[1.25cm]
{\contentslabel[\thecontentslabel]{1.5cm}}
{}
{\ \titlerule*[.5pc]{.}\;\thecontentspage}
[]

\makeatletter
\renewcommand\tableofcontents{
\null\hfill\textbf{\large\contentsname}\hfill\null\par
\@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
\@starttoc{toc}
}
\makeatother

\makeatletter
\renewcommand\tableofcontents{
\setlength\columnsep{10mm}
\begin{multicols}{2}[
\section*{\centering\huge\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}]
\@starttoc{toc}%
\end{multicols}}
\makeatother

%%%%%%%%%%%%%%%%%%%
\renewcommand{\theenumi}{\arabic{enumi}}
\renewcommand{\labelenumi}{\arabic{enumi}}
\renewcommand{\theenumii}{.\arabic{enumii}}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}.}
\renewcommand{\theenumiii}{.\arabic{enumiii}}
\renewcommand{\labelenumiii}{\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}.}

\usepackage[normalem]{ulem}
\ULdepth = 0.16em
\usepackage{pdf14}
\usepackage[unicode,bookmarksopen=true]{hyperref}
\doublehyphendemerits=1000000
\finalhyphendemerits=10000

\begin{document}
\clubpenalty=10000
\widowpenalty=10000

\titlepage

\chapter{С чего начать\ldots}
\newsavebox{\B}
\sbox{\B}{\includegraphics{B2.eps}}
\begin{wrapfigure}{l}{\wd\B}
\vbox to 10mm{\vss\usebox{\B}\vspace*{-3mm} }
\end{wrapfigure}
\noindent text.text.text...
\clearpage

• Thank you For the edit! This is my first time using this resource is not yet completely understood. – Dmitriy Feb 7 '18 at 18:44
• Welcome! You are using font macros which have been obsolete for a few decades (e.g. \bf) and ought not be used in LaTeX. You are also introducing a lot of spaces which you probably don't want. Whether this is the source of the shift I'm not sure, but I'd start by getting rid of those. You are missing \end{document}. I recommend using lettrine for the initial letter. You can use TikZ for the joining, I think, though I'm not certain I've understood correctly. Please try to reduce your example to just what's necessary to reproduce the problem. – cfr Feb 8 '18 at 2:19
• Why load enumitem and then not use it to change the appearance of enumerate counters? Remove graphics and color. xcolor loads color and graphicx supersedes graphics. Don't load enumerate if using enumitem. Ask for the compatibility option if you need it. Are you trying to set your whole document \sloppy? I don't know if it will work in the preamble, but that's a mad thing to do. Certainly don't bother with niceties such as microtype in this case. Its like fussing over your lemon sherbet while a swarm of locusts consumes your harvest. – cfr Feb 8 '18 at 2:27
• Also, nobody right now can reproduce your problem because we don't have the files. You can use example-image etc. (which everyone has) if you need images for your example. Also, please clarify your engine. – cfr Feb 8 '18 at 2:28

Designed the Chapter this way:

\DeclareRobustCommand{\redstar}{${\bigstar}$}
\DeclareRobustCommand{\lquercus}{\pgfornament[height=0.7cm,color=green!45!black,ydelta=-6pt]{79}}
\DeclareRobustCommand{\rquercus}{\pgfornament[height=0.7cm,symmetry=v,color=green!45!black,ydelta=-6pt]{79}}
\makeatletter
\vspace*{0\p@}
\setlength{\fboxsep}{1.0mm}
\setlength{\fboxrule}{0.7mm}\noindent\fbox{%
\setlength{\fboxsep}{2.0mm}%
\setlength{\fboxrule}{0.5mm}%
\framebox[\textwidth-13.0pt][c]{\hspace*{0.25\parindent}\Large\bfseries\MakeUppercase
{\lquercus\redstar\rquercus~~\@chapapp  \thechapter\hfill#1~~\lquercus\redstar\rquercus}\hspace*{0.25\parindent}}}
\par\nobreak
\vskip 10\p@}
\makeatother


Result:

Making initial letter:

\usepackage{ArtNouv}
\usepackage{lettrine}
\renewcommand{\LettrineFontHook}{\ArtNouvfamily{}}
\setcounter{DefaultLines}{3}


We had to replace the Cyrillic characters with similar in appearance Latin characters.

Excellent site!

Removed some unnecessary packages (amsthm, mathtext, enumerate, graphics, color, etoolbox, calc).

Disable the parameter \sloppy. Feared overflow lines, but it didn't happen. The view became much better, but after that in some places there was absolutely unnecessary number of consecutive transfers. To address this issue added to the preamble

\doublehyphendemerits = 1000000
\finalhyphendemerits = 10000


and corrected the text where it was needed.

Fixed the team

\AtBeginDocument {\ renewcommand \ contentsname {\ large \ bf Contents}}


on

\AtBeginDocument {\ renewcommand \ contentsname {\ large \ textbf {Contents}}}


Corrected the preamble to the previous question.

I can not use the lettrine package (there are no decorative Cyrillic fonts in TeXLive, unfortunately not).

I use dvips. Letters in .eps format (in Inkscape from the corresponding .ttf font). Insert here did not, as he kept the letters with a resolution of 1200 dpi and the picture looks on this site is huge. In principle, \tableofcontents can be placed at the end of the document, this is uncritical.

But still I would like to know if it is possible to connect the edges of the upper and lower lines in the design of the chapter, so that a frame around the title of the chapter turns out.

The document has a normal structure (titlepage, chapter1 ... chapter X, tableofcontents. Some chapters have minitoc in 1 column; some in 2 columns, and the first and at all without minitoc. Chapter with a minitoc in 2 columns:

\clearpage

\chapter{Chapter 1}
\noindent
\makebox[1.01\textwidth]{
{\begin{minipage}{\dimexpr\textwidth-7\mboxsep-3\mboxrule\relax}
\centering
\setlength\columnsep{10mm}
\begin{multicols}{2}
\startcontents[chapters]
\printcontents[chapters]{}{1}{}
\end{multicols}\\
\phantom{123}\\
\end{minipage}}
}

\newsavebox{\PP}
\sbox{\PP}{\includegraphics{PP2.eps}}
\begin{wrapfigure}{l}{\wd\PP}
\vbox to 10mm{\vss\usebox{\PP}\vspace*{-2.3mm}}
\end{wrapfigure}
\noindent text.text.text
\phantom{\lipsum[1]}
\section{Section 1.1}
\subsection{Subsection 1.1.1}
\section{Section 1.2}
\subsection{Subsection 1.1.2}
\subsubsection{Subsubsection 1.1.1.2}


and the like.

\end{document}


P.S. (10.04.2019) I solved the first problem so:

\begin{wrapfigure}{l}{1cm}
\vspace{-2.5ex}%
\centering\includegraphics[width=1.7cm]{v}% The extra space after the drop cap disappeared
\vspace{-2.5ex}%
\end{wrapfigure}
\noindent


I also slightly corrected the design of the Chapter:

\DeclareRobustCommand{\redstar}{\includegraphics[width=5.5mm{uzel38}}


Result:

Files v (the frame around the letters) and uzel38 created in the program Knotter.

https://knotter.mattbas.org/Knotter