![在案例环境中进行点填充](https://linux22.com/image/466085/%E5%9C%A8%E6%A1%88%E4%BE%8B%E7%8E%AF%E5%A2%83%E4%B8%AD%E8%BF%9B%E8%A1%8C%E7%82%B9%E5%A1%AB%E5%85%85.png)
\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}