嵌套调整宽度块 - 删除空格

嵌套调整宽度块 - 删除空格

我目前正在制作一份文件这个环境

我想在文本部分上添加一个制表符,我正在使用 来实现\adjustwidth。我想在此部分内添加另一个制表符部分,且上下没有空格。我该怎么做?

我意识到我没有使用 MWE 的电子书布局。我不想把所有额外内容都放在电子书中。我很抱歉。

梅威瑟:

\documentclass{article}

\usepackage{changepage} % for use of a tabbed over section for a small portion of the text e.g. in chapter 1

\begin{document}


\begin{adjustwidth}{2.5em}{0pt}
I want these words at this level \\ 
More at this level \\ 
\begin{adjustwidth}{2.5em}{0pt}
    I want these words at this level \\ 
    I do not want the whitespace above and below this level \\ 
\end{adjustwidth}
How can I get rid of the whitespace above and below the nested adjustwidth, or what's the best way to do this?\\ 
\end{adjustwidth}

\end{document}

enter image description here

答案1

您可以根据具体的线数调整par图表:shape

enter image description here

\documentclass{article}

\usepackage{changepage}

% http://tex.stackexchange.com/a/133660/5764
\makeatletter
\def\newparshape{\parshape\@npshape0{}}
\def\@npshape#1#2#3{\ifx\\#3\expandafter\@@@npshape\else\expandafter\@@npshape\fi
{#1}{#2}{#3}}
\def\@@npshape#1#2#3#4#5{%
\ifnum#3>\z@\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
{\expandafter\@@npshape\expandafter{\the\numexpr#1+1\relax}{#2 #4 #5}{\numexpr#3-1\relax}{#4}{#5}}%
{\@npshape{#1}{#2}}}
\def\@@@npshape#1#2#3{#1 #2 }
\makeatother

\begin{document}

\begin{adjustwidth}{2.5em}{0pt}
I want these words at this level \\ 
More at this level \\ 
\begin{adjustwidth}{2.5em}{0pt}
  I want these words at this level \\ 
  I do not want the whitespace above and below this level \\ 
\end{adjustwidth}
How can I get rid of the whitespace above and below the nested adjustwidth, or what's the best way to do this?\\ 
\end{adjustwidth}

\newparshape{2}{2.5em}{\dimexpr\linewidth-2em}{2}{5em}{\dimexpr\linewidth-5em}{1}{2.5em}{\dimexpr\linewidth-2.5em}\\
\noindent I want these words at this level \\ 
More at this level \\ 
  I want these words at this level \\ 
  I do not want the whitespace above and below this level \\ 
How can I get rid of the whitespace above and below the nested adjustwidth, or what's the best way to do this?\\ 

\end{document}

相关内容