答案1
点击图片可查看更高分辨率
编辑 1:添加了奇数/偶数页检查
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{lipsum}
\usepackage{array}
\usepackage{varwidth}
\usepackage{changepage}
\strictpagecheck
\def\maxwidth{13cm}
\newcolumntype{M}{>{\begin{varwidth}{\maxwidth}}l<{\end{varwidth}}}
\newenvironment{myenvi}
{%
\checkoddpage
\ifoddpage
\hfill\begin{tabular}{@{}M@{}}
\fi
}
{%
\checkoddpage
\ifoddpage
\end{tabular}\hspace{-3.5pt}
\fi
}
\setlength{\parskip}{1ex}
\begin{document}
\lipsum[1]
\begin{myenvi}
Oh, this is what I want!
I really want some lines like this
And this line is a bit too long, so it will be broken to some lines blah blah. And this line is a bit too long, so it will be broken to some lines. And this line is a bit too long, so it will be broken to some lines. And this line is a bit too long, so it will be broken to some lines.
\end{myenvi}
And some more normal lines
\begin{myenvi}
This is a short text for testing whose total width is clearly less than 10cm.
And this is an even shorter text.
\end{myenvi}
\lipsum[2-6]
\begin{myenvi}
This is the environment for check in an even page. It should be like normal text.
Yes, this is normal text!
\end{myenvi}
\lipsum[7]
\end{document}
第 1 页(奇数):
第 2 页(偶数):
原始答案
定义新的tabular
列类型并使用\hfill
\documentclass{article}
\usepackage{lipsum}
\usepackage{array}
\usepackage{varwidth}
\newcolumntype{M}{>{\begin{varwidth}{10cm}}l<{\end{varwidth}}}
\setlength{\parskip}{1ex}
\begin{document}
\lipsum[1]
\hfill\begin{tabular}{@{}M@{}}
Oh, this is what I want!
I really want some lines like this
And this line is a bit too long, so it will be broken to some lines blah blah. And this line is a bit too long, so it will be broken to some lines. And this line is a bit too long, so it will be broken to some lines. And this line is a bit too long, so it will be broken to some lines.
\end{tabular}
\lipsum[2]
\end{document}