如何让我的图表像这样立在右侧?

如何让我的图表像这样立在右侧?

我想让我的图表像这样站在右侧

\documentclass[a4paper , 12pt]{article}
\usepackage{color}
\usepackage{array}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[utf8]{vietnam}
\usepackage{tikz,tkz-tab}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usepackage{mathtools}
\usetikzlibrary{arrows}
\renewcommand{\baselinestretch}{1.5} %Chỉnh dãn dòng
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
{\color{blue}\textbf{Câu 5: }} Cho đồ thị của hàm số $y=x^4-3x^2-3$ như hình dưới. Với giá trị nào của $m$ thì $x^4-3x^2+m=0$ có đúng ba nghiệm phân biệt?\\
\begin{center}
\definecolor{qqwuqq}{rgb}{0.,0.39215686274509803,0.}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.65cm,y=0.65cm]
\begin{axis}[
x=0.65cm,y=0.65cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-3.085554436516331,
xmax=3.1948065326963238,
ymin=-5.445845932334671,
ymax=1.1433852484786022,
xtick={-3.0,-2.0,...,3.0},
ytick={-5.0,-4.0,...,1.0},]
\clip(-3.085554436516331,-5.445845932334671) rectangle (3.1948065326963238,1.1433852484786022);
\draw[line width=0.4pt,color=qqwuqq,smooth,samples=100,domain=-3.085554436516331:3.1948065326963238] plot(\x,{(\x)^(4.0)-3.0*(\x)^(2.0)-3.0});
\begin{scriptsize}
\draw[color=qqwuqq] (-1.9530303273140492,4.90988588438619) node {$f$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\end{center}
\begin{tabular}{llrr}
{\color{red}\textbf{A. }} m=0 & {\color{blue}\textbf{B. }} m=4 & {\color{blue}\textbf{C. }} m=-4  & {\color{blue}\textbf{D. }} m=-3 \\
\end{tabular}
\end{document}

答案1

另一种常用的方法是使用minipage\raisebox。它有助于先测量宽度。

\documentclass[a4paper , 12pt]{article}
\usepackage{color}
\usepackage{array}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[utf8]{vietnam}
\usepackage{tikz,tkz-tab}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usepackage{mathtools}
\usetikzlibrary{arrows}
\renewcommand{\baselinestretch}{1.5} %Chỉnh dãn dòng
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}

\begin{document}
\sbox0{% measure size
\definecolor{qqwuqq}{rgb}{0.,0.39215686274509803,0.}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.65cm,y=0.65cm]
\begin{axis}[
x=0.65cm,y=0.65cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-3.085554436516331,
xmax=3.1948065326963238,
ymin=-5.445845932334671,
ymax=1.1433852484786022,
xtick={-3.0,-2.0,...,3.0},
ytick={-5.0,-4.0,...,1.0},]
\clip(-3.085554436516331,-5.445845932334671) rectangle (3.1948065326963238,1.1433852484786022);
\draw[line width=0.4pt,color=qqwuqq,smooth,samples=100,domain=-3.085554436516331:3.1948065326963238] plot(\x,{(\x)^(4.0)-3.0*(\x)^(2.0)-3.0});
\begin{scriptsize}
\draw[color=qqwuqq] (-1.9530303273140492,4.90988588438619) node {$f$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}}%
%
\begin{minipage}[t]{\dimexpr \textwidth-\wd0-\columnsep}
{\color{blue}\textbf{Câu 5: }} Cho đồ thị của hàm số $y=x^4-3x^2-3$ như hình dưới. Với giá trị nào của $m$ thì $x^4-3x^2+m=0$ có đúng ba nghiệm phân biệt?\\

\noindent\hfil\begin{tabular}{llrr}
{\color{red}\textbf{A. }} m=0 & {\color{blue}\textbf{B. }} m=4 & {\color{blue}\textbf{C. }} m=-4  & {\color{blue}\textbf{D. }} m=-3 \\
\end{tabular}
\end{minipage}\hfill\raisebox{-\ht0}{\usebox0}

The next line starts here.

\end{document}

演示

答案2

这是一种损害最小的答案,其中我只对代码做了微小的更改。我将其中的 scriptsize 环境更改为\color\textcolor合适tikzpicture的环境。(为什么要加载 pgfplots 并启动轴,您在使用它吗?)

\documentclass[a4paper , 12pt]{article}
\usepackage{color}
\usepackage{array}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[utf8]{vietnam}
\usepackage{tikz,tkz-tab}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usepackage{mathtools}
\usepackage{wrapfig}
\usetikzlibrary{arrows}
\renewcommand{\baselinestretch}{1.5} %Chỉnh dãn dòng
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}

\begin{wrapfigure}[10]{r}[0pt]{6cm}
\definecolor{qqwuqq}{rgb}{0.,0.39215686274509803,0.}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.65cm,y=0.65cm]
\begin{axis}[
x=0.65cm,y=0.65cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-3.085554436516331,
xmax=3.1948065326963238,
ymin=-5.445845932334671,
ymax=1.1433852484786022,
xtick={-3.0,-2.0,...,3.0},
ytick={-5.0,-4.0,...,1.0},]
\clip(-3.085554436516331,-5.445845932334671) rectangle (3.1948065326963238,1.1433852484786022);
\draw[line width=0.4pt,color=qqwuqq,smooth,samples=100,domain=-3.085554436516331:3.1948065326963238] plot(\x,{(\x)^(4.0)-3.0*(\x)^(2.0)-3.0});
\draw[color=qqwuqq] (-1.9530303273140492,4.90988588438619) node[font=\scriptsize] {$f$};
\end{axis}
\end{tikzpicture}
\end{wrapfigure}


\textcolor{blue}{\textbf{Câu 5:}} Cho đồ thị của hàm số $y=x^4-3x^2-3$ như hình dưới. Với giá trị nào của $m$ thì $x^4-3x^2+m=0$ có đúng ba nghiệm phân biệt?\\
\begin{tabular}{llrr}
\textcolor{red}{\textbf{A. }} m=0 & \textcolor{blue}{\textbf{B. }} m=4 & 
\textcolor{blue}{\textbf{C. }} m=-4  & \textcolor{blue}{\textbf{D. }} m=-3 \\
\end{tabular}
\end{document}

在此处输入图片描述

答案3

如果您经常需要边距数字,请考虑使用tufte-handouttufte-book类:

姆韦

\documentclass{tufte-book}
\usepackage{color}
\usepackage{array}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[utf8]{vietnam}
\usepackage{tikz,tkz-tab}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usepackage{mathtools}
\usetikzlibrary{arrows}
\definecolor{qqwuqq}{rgb}{0.,0.39215686274509803,0.}
\begin{document}
\noindent{\color{blue}\textbf{Câu 5: }} Cho đồ thị của hàm số $y=x^4-3x^2-3$ như hình dưới. Với giá trị nào của $m$ thì $x^4-3x^2+m=0$ có đúng ba nghiệm phân biệt?
\begin{marginfigure}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.65cm,y=0.65cm]
\begin{axis}[
x=0.65cm,y=0.65cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-3.085554436516331,
xmax=3.1948065326963238,
ymin=-5.445845932334671,
ymax=1.1433852484786022,
xtick={-3.0,-2.0,...,3.0},
ytick={-5.0,-4.0,...,1.0},]
\clip(-3.085554436516331,-5.445845932334671) rectangle (3.1948065326963238,1.1433852484786022);
\draw[line width=0.4pt,color=qqwuqq,smooth,samples=100,domain=-3.085554436516331:3.1948065326963238] plot(\x,{(\x)^(4.0)-3.0*(\x)^(2.0)-3.0});
\begin{scriptsize}
\draw[color=qqwuqq] (-1.9530303273140492,4.90988588438619) node {$f$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\end{marginfigure}
\begin{itemize}[leftmargin=2em]
\item[\color{red}A.] $\mathrm{m}=0$
\item[\color{blue}B.] $\mathrm{m}=4$ 
\item[\color{blue}C.] $\mathrm{m}=-4$ 
\item[\color{blue}D.] $\mathrm{m}=-3$ 
\begin{itemize}
\end{document}

相关内容