1

There is the problem with \hangindent. Here is the code which I've used:

\documentclass[12pt]{article}
\usepackage[cp1251]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{cmap}
\usepackage{amsthm}
\usepackage{amscd}
\usepackage[matrix,arrow,curve]{xy}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\usepackage{wrapfig}
\usepackage{lipsum}
% SIZES
\textwidth=15.0 cm
\textheight=21.0 cm
\hoffset=-1cm
\voffset=-2cm

\setlength{\unitlength}{1.09mm}


\begin{document}
    \begin{proof}
    \lipsum[1]
    \hangindent=-5cm \hangafter=-6

    \lipsum[2]
    \end{proof}
\end{document}

And the document which this code products: enter image description here Here you see two indented blocks in the proof environment. Meanwhile I need only one indented block. If you try to continue this process --- indenting continues on and on for each new white row. How can I handle it? I need it in proof environment.

UPD Here is some code, but it still indents both of the paragraphs:

\begin{proof}           
        
    \hangindent=-5cm \hangafter=-5
    \lipsum[1] \\
    
    \lipsum[2]
\end{proof}

UPD2 All I needed to do is brackets:

\begin{proof}           
        
    {\hangindent=-5cm \hangafter=-5
    \lipsum[1] \par} 
    
    \lipsum[2]
\end{proof}
10
  • 2
    Please -- as usual here -- show us a short tex code resulting in your issue ...
    – Mensch
    May 27, 2021 at 9:04
  • @Mensch, I've written commands which are rising the error, what else can I provide here?
    – taciturno
    May 27, 2021 at 10:12
  • 1
    Start with \documentclass and end the code with \end{document}, then we do not have to guess what you are doing ...
    – Mensch
    May 27, 2021 at 10:47
  • 2
    Use the lipsum package to get reams of text. All you have said is that you use the \hang... macros, not how you use them in relation to the text. May 27, 2021 at 17:03
  • 1
    @taciturno The code doesn't produce the image you show.
    – egreg
    May 31, 2021 at 17:42

2 Answers 2

1

The instructions

\hangindent=-5cm \hangafter=-6

mean that in the current paragraph we want to shorten the first six lines to a length of 5cm less than the standard width.

Note that “current paragraph” is the key. The instructions can be pretty anywhere in the paragraph, but it's best to place them at the very beginning so you can spot them.

In your case, some quirks of lipsum enter into the scene, but you will get away with

\documentclass[12pt]{article}
%\usepackage[cp1251]{inputenc} % ?
\usepackage[english,russian]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{cmap}
\usepackage{amsthm}
%\usepackage{amscd} % ?
\usepackage[matrix,arrow,curve]{xy}
%\usepackage{pgfplots}
%\pgfplotsset{compat=1.15}
%\usepackage{mathrsfs}
%\usetikzlibrary{arrows}
%\usepackage{wrapfig}
\usepackage{lipsum}

%%%% don't use such settings! Use geometry
%% SIZES
%\textwidth=15.0 cm
%\textheight=21.0 cm
%\hoffset=-1cm
%\voffset=-2cm
\usepackage{geometry}
\geometry{
  textwidth=15cm,
  textheight=21cm,
}

\setlength{\unitlength}{1.09mm} % ?


\begin{document}

\begin{proof}
Лорем ипсум долор сит амет, фацете еурипидис еу вел. Еу цоммодо воцибус 
фацилис еос. Ан бруте патриояуе витуператорибус еум, феугиат пхаедрум пер 
еу, ерос опортере ет вим. Омиттам репудиаре ан цум, ид меа муциус фацилиси 
менандри. Ипсум малуиссет при ут. Меи еи агам алтерум партиендо, ид еос 
волумус сцаевола волуптариа, ин мунди нонумы поссит яуо.

\hangindent=-5cm \hangafter=-6
Аудире салутатус усу но, антиопам персеяуерис иус не, вим сонет солеат 
сентентиае ут. Еу яуо ехерци фиерент волуптариа, хас пробо сцрипсерит еа, 
ин цетерос сусципит детрахит еум. Пауло тритани волуптатум при ет, ех юсто 
фугит про. Омнесяуе елеифенд не усу, ет путент персецути меа. Еа сумо 
малуиссет мел, но вел нибх ехпетенда. Еу ест дицо молестиае. Еу дицам 
урбанитас иус, ад тимеам луцилиус праесент при. Дебитис медиоцрем 
продессет ут усу, иус ид амет утинам. Ферри персеяуерис ат дуо, еу 
усу тота урбанитас. Ех доцтус вивендо легендос пер.
\end{proof}

\end{document}

Leave a blank line before the instructions and no blank line after it.

I've made some other changes to your code. Use UTF-8, not cp1251, if you can. I don't think you need both xy and amscd (the latter producing diagrams with much lower quality than the former). Don't hand craft page parameters, use geometry: beware that setting \hoffset may have adverse effects with graphics packages. I commented out some packages that aren't involved in the issue at hand.

I used a “Russian lipsum generator” to get the text.

enter image description here

5
  • Does this mean that I can't make an indentation with first 5 lines?
    – taciturno
    Jun 1, 2021 at 8:45
  • @taciturno Use \hangafter=-5
    – egreg
    Jun 1, 2021 at 8:48
  • I mean that if I'm trying to indent first paragraph, latex instead indents both of the paragraphs (please look at the "updated" in the question for code)
    – taciturno
    Jun 1, 2021 at 8:54
  • I founded out the problem: I used braces for using only particular paragraph
    – taciturno
    Jun 1, 2021 at 9:04
  • anyways, it's not working again... Some strange things happening
    – taciturno
    Jun 1, 2021 at 17:06
1

The problem is that LaTeX re-defines \par inside the proof environment. Primitive \par creates paragraph and re-initializes the \hangindent and \hangafter primitive registers. But LaTeX re-defines \par (i.e. blank line) as {\par} inside proof environment. So the re-initialization is done inside a group and when the group is finished then the previous values (from previous paragraph) is restored. But you don't want to use the same values for second paragraph. You can use \endgraf (which is equivalent to primitive \par) instead the blank line:

\begin{proof}
\lipsum[1]
\hangindent=-5cm \hangafter=-6
\endgraf
\lipsum[2]
\end{proof}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .