强制取消跳过段落

强制取消跳过段落

我用它OmegaT来翻译大量文本,然后将其导出为文本文件格式。但是,由于OmegaT文本单元的拆分方式(他们称之为“分段”),我有时会得到以下结果:

This is the beginning of a line;
[this is a blank line]
and this is the end of the line.

当被处理时LaTeX,它们会被分成段落。

由于我能够LaTeX在翻译的文本中使用代码,我想知道是否有可能实现以下操作:

This is the beginning of a line;\unskip
[this is a blank line]
\unskip and this is the end of the line.

可以连续排版。(当然,\unskip这里不行。)

这也不起作用:

This is the beginning of a line;%
[this is a blank line]
\unskip and this is the end of the line.

因为后面有一个空行%,当然。

关于如何解决这个问题有什么想法吗?

答案1

你需要这个吗?

\documentclass{article}

\makeatletter
\newcommand\ignorenextpar{%
  \unskip\@ifnextchar\par{ \@gobble}{ }%
}
\makeatother

\begin{document}

This is the beginning of a line;\ignorenextpar

and this is the end of the line.

The above blank line should not be ignored.\ignorenextpar
This should be normally spaced

\end{document}

在此处输入图片描述

处理多个空行的版本:

\documentclass{article}

\makeatletter
\newcommand\ignorenextpar{%
  \@ifnextchar\par{\@gobblenextpar}{ }%
}
\newcommand\@gobblenextpar[1]{\ignorenextpar}
\makeatother

\begin{document}

This is the beginning of a line;\ignorenextpar

and this is the end of the line.

This is the beginning of a line;\ignorenextpar


and this is the end of the line.

The above blank line should not be ignored.\ignorenextpar
This should be normally spaced

\end{document}

答案2

在此处输入图片描述

\documentclass{article}

\begin{document}
{\def\par{\ifhmode\unskip\fi\space\ignorespaces}
This is the beginning of a line;

and this is the end of the line.
}

\end{document}

相关内容