Мне нужно, чтобы в самой первой строке документа и в каждой строке, которая следует за явно указанным разрывом (\\), между первым символом и левым полем страницы было пространство 0 мм (без пробела) (что является поведением по умолчанию), в то время как каждая строка, которая следует за неявно инициированным TeX разрывом (из-за достижения правого поля страницы), начинается с пробела (между первым символом и левым полем страницы), который на 10 мм больше, чем пробел в предыдущей строке.
1234567890123456789012345678901234567 <- 37 characters before auto-wrap
This is very first line with no space
while this is second line after
automatic break.\\
This line also doesn't begin with
space but this one does.
решение1
Пустая строка понятнее, чем \\
.
Вот способ, использующий \parshape
:
\documentclass[twocolumn]{article}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentEnvironment{bizarre}{O{\columnwidth}}
{
\par
\setlength{\parindent}{0pt}
\bp_make_parshape:n { #1 }
\everypar{\parshape 50~\l_bp_parshape_tl}
}
{
\par
}
\tl_new:N \l_bp_parshape_tl
\dim_new:N \l_bp_parshape_dim
\cs_new:Nn \bp_make_parshape:n
{
\dim_set:Nn \l_bp_parshape_dim { #1 }
\tl_set:Nx \l_bp_parshape_tl
{
\int_step_function:nN { 50 } \__bp_parshape:n
}
}
\cs_new:Nn \__bp_parshape:n
{
\dim_eval:n { 10mm*(#1-1) } ~
\dim_eval:n { \l_bp_parshape_dim - 10mm*(#1-1) }
}
\ExplSyntaxOff
\begin{document}
\begin{bizarre}
This is very first line with no space
while this is second line after
automatic break.
This line also doesn't begin with
space but this one does.
\end{bizarre}
\begin{bizarre}[0.8\columnwidth]
This is very first line with no space
while this is second line after
automatic break.
This line also doesn't begin with
space but this one does.
\end{bizarre}
\end{document}