\dotfill
我正在尝试在方程式环境中使用cases
。我在这里采用了解决方案:案例中的对齐和点填充
但是,我希望能够在括号左侧写一些内容,而点不会超出范围textwidth
。这是我的
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{lipsum}
\makeatletter
\newcommand*\Annadotfill{%
\leavevmode
% Do you really want "\cleaders"?
\cleaders \hb@xt@ .33em{\hss .\hss }\hfill
\kern \z@
}
\@ifdefinable\@Anna@brace@width{\newdimen\@Anna@brace@width}
\settowidth\@Anna@brace@width{%
$\left\{\vbox{\vskip \@m \p@}\right.\kern -\nulldelimiterspace$%
}
\newenvironment{Annacases}{%
\left\{%
\tabcolsep \z@
\def\arraystretch{1.2}% linespread: adjust as you please
\tabularx{\dimexpr \linewidth-\@Anna@brace@width \relax}%
{>{$}r<{$}>{${}}X<{$}}%
}{%
\endtabularx
\right.%
\kern -\nulldelimiterspace
}
\makeatother
\begin{document}
$
f(x) = \begin{Annacases}
x & \Annadotfill \text{text;}\\
1-x & \Annadotfill \text{more text;}
\end{Annacases}
$
\lipsum[1]
\end{document}
我怎样才能修改代码以保留所有内容textwidth
?
答案1
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{lipsum}
\begin{document}
$
f(x) =
\left\{
\begin{array}{@{}r@{}}
x\\
1-x
\end{array}
\right.
\leaders
\hbox{$%
\begin{array}{@{\,}r@{\,}}
.\\
.
\end{array}%
$}\hfill
\begin{tabular}{@{}r@{}}
text;\\
more text;
\end{tabular}
$
\lipsum[1]
\end{document}