Поместите две картинки рядом с LaTeX - PullRequest
1 голос
/ 05 марта 2020

У меня есть две tikzpitctures в LaTeX, которые я надеялся получить рядом. Кто-нибудь знает solid способ сделать это? Я выложу код и скриншот того, как он выглядит сейчас. Если нет, есть ли другой подход к созданию диаграмм Венна бок о бок? Спасибо!

% %%%%%%%%%%%%%%%%%%%
\section*{Question 1}
% %%%%%%%%%%%%%%%%%%%
{\bfseries Determine the relationship between $P = (A-B)-C$ and $Q = (A-C)-(B-C)$}

{\bfseries Answer: $P = Q$}

% %%%%%%%%%%%%%%%%%%%
\subsection*{Justification 1: Venn Diagram}
% %%%%%%%%%%%%%%%%%%%
\def\firstcircle{ (0.0, 0.0) circle (1.5)}
\def\secondcircle{(2.0, 0.0) circle (1.5)}
\def\thirdcircle{ (1.0,-1.5) circle (1.5)}
\def\rectangle{ (-1.5,-3.0) rectangle (3.5,1.0) }
\colorlet{circle edge}{black}
\colorlet{circle area}{blue!30}

\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},
    outline/.style={draw=circle edge, thick}}

\begin{tikzpicture}
    \begin{scope}
        \fill[filled]  \firstcircle;
        \fill[white]  \secondcircle;
        \fill[white] \thirdcircle;
    \end{scope}
    \draw[outline] \firstcircle  node[left]  {$A$};
    \draw[outline] \secondcircle node[right] {$B$};
    \draw[outline] \thirdcircle  node[below] {$C$};
    \node[anchor=south] at (current bounding box.north) 
      {$P = (A - B) - C$};
\end{tikzpicture}

\begin{tikzpicture}
    \begin{scope}
        \fill[filled]  \firstcircle;
        \fill[white]  \secondcircle;
        \fill[white] \thirdcircle;
    \end{scope}
    \draw[outline] \firstcircle  node[left]  {$A$};
    \draw[outline] \secondcircle node[right] {$B$};
    \draw[outline] \thirdcircle  node[below] {$C$};
    \node[anchor=south] at (current bounding box.north) 
      {$Q = (A - C) - (B - C)$};
\end{tikzpicture}
\pagebreak

a

Ответы [ 2 ]

1 голос
/ 05 марта 2020

Вы заставляете два изображения находиться в отдельных строках, оставляя пустую строку между двумя изображениями. Для латекса пустая строка обозначает начало нового абзаца.

\documentclass{article}

\usepackage{tikz}

\begin{document}

% %%%%%%%%%%%%%%%%%%%
\section*{Question 1}
% %%%%%%%%%%%%%%%%%%%
{\bfseries Determine the relationship between $P = (A-B)-C$ and $Q = (A-C)-(B-C)$}

{\bfseries Answer: $P = Q$}

% %%%%%%%%%%%%%%%%%%%
\subsection*{Justification 1: Venn Diagram}
% %%%%%%%%%%%%%%%%%%%
\def\firstcircle{ (0.0, 0.0) circle (1.5)}
\def\secondcircle{(2.0, 0.0) circle (1.5)}
\def\thirdcircle{ (1.0,-1.5) circle (1.5)}
\def\rectangle{ (-1.5,-3.0) rectangle (3.5,1.0) }
\colorlet{circle edge}{black}
\colorlet{circle area}{blue!30}

\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},
    outline/.style={draw=circle edge, thick}}

\begin{tikzpicture}
    \begin{scope}
        \fill[filled]  \firstcircle;
        \fill[white]  \secondcircle;
        \fill[white] \thirdcircle;
    \end{scope}
    \draw[outline] \firstcircle  node[left]  {$A$};
    \draw[outline] \secondcircle node[right] {$B$};
    \draw[outline] \thirdcircle  node[below] {$C$};
    \node[anchor=south] at (current bounding box.north) 
      {$P = (A - B) - C$};
\end{tikzpicture}
%
\begin{tikzpicture}
    \begin{scope}
        \fill[filled]  \firstcircle;
        \fill[white]  \secondcircle;
        \fill[white] \thirdcircle;
    \end{scope}
    \draw[outline] \firstcircle  node[left]  {$A$};
    \draw[outline] \secondcircle node[right] {$B$};
    \draw[outline] \thirdcircle  node[below] {$C$};
    \node[anchor=south] at (current bounding box.north) 
      {$Q = (A - C) - (B - C)$};
\end{tikzpicture}
\pagebreak

\end{document}

enter image description here

0 голосов
/ 27 апреля 2020

Вы всегда можете нарисовать огромную сетку, у меня есть именно эта проблема ... и я рисую сетку, особенно если ваша схема представляет собой последовательность, в которой большинство вещей остается неизменным ... но некоторые вещи меняются для каждого нового изображения. .. как мультфильм ... у вас будет просто изменить координаты при копировании новой картинки ..

Очень легко все расставить и адаптировать под свою эстетику c ...

Вы можете даже использовать различные размеры шагов в сетке.

Как только вы нарисовали общую схему, измените линии сетки на белый, и он не будет отображаться в отрисованном файле PDF.

Надеюсь, что помогает

...