如何在自动换行后的每一行自动添加空格?

如何在自动换行后的每一行自动添加空格?

我需要的是文档中的第一行以及紧随明确指定的换行符(\\)之后的每一行,其第一个字符与页面左边距之间都有 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}

在此处输入图片描述

相关内容