我想在文档中对齐这两个内容,但是我该怎么做呢?因为如果我添加\hfill
,它不会产生我想要的效果。我该怎么做呢?
\documentclass[12pt, a4paper]{article}
\usepackage{tikz,tkz-tab}
\usepackage{pgfplots}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{environ}
\usepackage{varwidth}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
\newlength{\MyMdframedWidthTweak}
\NewEnviron{mymdframed}[1][]{
\setlength{\MyMdframedWidthTweak}{\dimexpr
+\mdflength{innerleftmargin}
+\mdflength{innerrightmargin}
+\mdflength{leftmargin}
+\mdflength{rightmargin}
}
\savebox0{
\begin{varwidth}{\dimexpr\linewidth-\MyMdframedWidthTweak\relax}
\BODY
\end{varwidth}
}
\begin{mdframed}[
backgroundcolor=white,
shadow=false,
shadowsize=0pt,
roundcorner=0pt,
userdefinedwidth=\dimexpr\wd0+\MyMdframedWidthTweak\relax,
#1]
\usebox0
\end{mdframed}
}
\begin{document}
\begin{mymdframed}
\textbf{\underline{Propriété :}} (admise)
\smallskip
\\
Soient $A_1$, $A_2$, \dots , $A_p$, $p$ ensembles finis deux à deux disjoints.
\\
\smallskip
On a : $|A_1\cup A_2\cup \dots \cup A_p| = |A_1| + |A_2| + \dots + |A_p|$
\end{mymdframed}
\begin{tikzpicture}
\begin{scope}
\clip (0,0) ellipse [x radius=2, y radius=1];
\path[name path=a] (0,0) ellipse [x radius=2, y radius=1];
\draw (0,0) ellipse [x radius=2, y radius=1];
\foreach \i/\j in {-1.5/$A_1$,-0.75/$A_2$,0/$A_3$,0.8/$\dots$,1.6/$A_p$}
{
\draw[black] (\i,-1) to[out=45, in=315] (\i,1);
\node[black] at (\i,0) {\j};
}
\end{scope}
\end{tikzpicture}
\end{document}
答案1
如果您愿意利用该空间做边注,那么您可以这么做。
(1)将内容物装入盒子。(使用包装xcoffin
)。
(2)连接盒子:将盒子的右侧中心mdframed
与盒子的左侧中心连接起来tikzpicture
,并添加一些水平空间。
(3)将结果排版为文本对象。
使用\SetVerticalCoffin\mymdf{0.65\textwidth}{%
将适合文本区域中的组件。
这是第一个图的代码。
\documentclass[12pt, a4paper]{article}
\usepackage{tikz,tkz-tab}
\usepackage{pgfplots}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{environ}
\usepackage{varwidth}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
\newlength{\MyMdframedWidthTweak}
\NewEnviron{mymdframed}[1][]{
\setlength{\MyMdframedWidthTweak}{\dimexpr
+\mdflength{innerleftmargin}
+\mdflength{innerrightmargin}
+\mdflength{leftmargin}
+\mdflength{rightmargin}
}
\savebox0{
\begin{varwidth}{\dimexpr\linewidth-\MyMdframedWidthTweak\relax}
\BODY
\end{varwidth}
}
\begin{mdframed}[
backgroundcolor=white,
shadow=false,
shadowsize=0pt,
roundcorner=0pt,
userdefinedwidth=\dimexpr\wd0+\MyMdframedWidthTweak\relax,
#1]
\usebox0
\end{mdframed}
}
\usepackage{showframe} % show mrgin <<<<<<<
\renewcommand\ShowFrameColor{\color{red}}
\renewcommand\ShowFrameLinethickness{0.15pt}
\usepackage{xcoffins}% added <<<<<<<<<<
\NewCoffin\mymdf % create
\NewCoffin\mytikz
\begin{document}
\SetVerticalCoffin\mymdf{0.70\textwidth}{% Adjust the with of the frame
\begin{mymdframed}
\textbf{\underline{Propriété :}} (admise)
\smallskip
\\
Soient $A_1$, $A_2$, \dots , $A_p$, $p$ ensembles finis deux à deux disjoints.
\\
\smallskip
On a : $|A_1\cup A_2\cup \dots \cup A_p| = |A_1| + |A_2| + \dots + |A_p|$
\end{mymdframed}
}
\SetHorizontalCoffin\mytikz{%
\begin{tikzpicture}
\begin{scope}
\clip (0,0) ellipse [x radius=2, y radius=1];
\path[name path=a] (0,0) ellipse [x radius=2, y radius=1];
\draw (0,0) ellipse [x radius=2, y radius=1];
\foreach \i/\j in {-1.5/$A_1$,-0.75/$A_2$,0/$A_3$,0.8/$\dots$,1.6/$A_p$}
{\draw[black] (\i,-1) to[out=45, in=315] (\i,1);
\node[black] at (\i,0) {\j};
}
\end{scope}
\end{tikzpicture}
}
As any dedicated reader can clearly see, the Ideal of
practical reason is a representation of, as far as I know, the things
in themselves; as I have shown elsewhere, the phenomena should only be
used as a canon for our understanding.
\JoinCoffins\mymdf[r,vc]\mytikz[l,vc](20pt,0pt) % join the right side center of \mymdf with left side center of \mytikz
% and displace 20pt to the right
\noindent\TypesetCoffin\mymdf % typeset the assembly in the current insertion point
Let us suppose that the noumena have nothing to do
with necessity, since knowledge of the Categories is a
posteriori. Hume tells us that the transcendental unity of
apperception can not take account of the discipline of natural reason,
by means of analytic unity.
\end{document}