在一项有分级规则的练习中,我尝试缩小负数的白色方框,我希望白色矩形像正数一样小,但就像减号在每个角上都设置了矩形的极限,即使不是,所以在右边。我不知道如何缩小这样的方框 o_0... :-(
这是此部分的代码:
%----------------------------------------------------------------
%mathématiques - fichier numérique de tous mes exercices
%----------------------------------------------------------------
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel} %pour le symbole n°
\frenchbsetup{StandardLists=true} % pour les listes avec \enumitem : à inclure si on utilise
\usepackage{enumitem}
% spécification des marges, taille papier
%\usepackage[a4paper]{geometry}
%\geometry{hscale=0.85,vscale=0.85,centering}
%\usepackage{fullpage} % une autre solution, pas testée
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[C]{}
\fancyhead[L]{}
\fancyhead[R]{}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[C]{}
\fancyfoot[L]{}
\fancyfoot[R]{\raggedright\mbox{\frakfamily\fraklines\yinipar{S}}}
\usepackage[left=2cm,right=1cm,top=1cm,bottom=2.5cm]{geometry}
% fin de la définition des marges
\usepackage{frcursive}
\usepackage{yfonts}
\usepackage{amsmath}
\usepackage{tikz}
% le package qui pemet de définir des unités et leur affichage
\usepackage{siunitx} % Alignement des valeurs etc.
\sisetup{
round-mode = places, % Rounds numbers
round-precision = 2, % to 2 places
}
\usepackage{xcolor} % pour les couleurs sur les règles graduées par exemple
\definecolor{shamrockgreen}{rgb}{0.0, 0.62, 0.38}
\definecolor{rose}{rgb}{1.0, 0.0, 0.5}
\definecolor{richlavender}{rgb}{0.67, 0.38, 0.8}
\definecolor{tangelo}{rgb}{0.98, 0.3, 0.0}
%----------------------------------------------------------%
\begin{document}
\noindent MATH\'EMATIQUES
\newline
\vspace{1cm}
\noindent\begin{cursive}Un exemple de repère:\end{cursive}
\begin{center}
\begin{tikzpicture}
\draw (0,0) node {$\bullet$};
\draw (0,0) node[below left]{$O$};
\draw[->] (-0.4,0) -- (1,0);
\draw[dashed] (-1.1,0) -- (-0.4,0);
\draw (1,0) node[below]{$x$};
\draw[->] (0,-0.4) -- (0,1);
\draw[dashed] (0,-0.8)-- (0,-0.4);
\draw (0,1) node[left]{$y$};
\draw [dashed] (1,0) -- (2.4,0);
\draw [dashed] (0,1) -- (0,2.4);
\draw [dashed] (2,2) -- (2,0) node[below] {$2$};
\draw [dashed] (2,2) -- (0,2) node[left] {$2$};
\fill [red] (2,2) node[above=2mm,right]{$\alpha(2,2)$} ;
\end{tikzpicture}
\end{center}
\vspace{1cm}
\noindent\begin{cursive}Exercice \no 12 p29:\end{cursive}
\begin{enumerate}[label=\alph*)]
\item les abscisses des points sont en bleu:
\begin{center}
\begin{tikzpicture}[scale=15]
\draw[->] [thick](-0.68,0) -- (0.13,0);
\draw[step=0.01][very thin, gray] (-0.68,-0.06) grid (0.13,0.06);
%le point M
\draw (-0.6,0) node [above=5pt, red,fill=white]{$M$};
\draw (-0.6,0) node {$|$};
\draw (-0.6,0) node [below=5pt, blue,fill=white]{$-0,6\phantom{-}$};
\draw (-0.5,0) node {$|$};
%le point N
\draw (-0.4,0) node [above=5pt, red,fill=white]{$N$};
\draw (-0.4,0) node [below=5pt]{$-0,4\phantom{-}$};
\draw (-0.4,0) node {$|$};
\draw (-0.3,0) node [below=5pt]{$-0,3\phantom{-}$};
\draw (-0.3,0) node {$|$};
\draw (-0.2,0) node {$|$};
%le point 0
\draw (-0.1,0) node [above=5pt, red,fill=white]{$O$};
\draw (-0.1,0) node {$|$};
\draw (-0.1,0) node [below=5pt, blue,fill=white]{$-0,1\phantom{-}$};
\draw (0,0) node {$|$};
\draw (0,0) node [below=5pt]{$0$};
%le point P
\draw (0.1,0) node [above=5pt, red,fill=white]{$P$};
\draw (0.1,0) node {$|$};
\draw (0.1,0) node [below=5pt, blue,fill=white]{$0,1$};
\end{tikzpicture}
\end{center}
\item les points S et T :
\begin{center}
\begin{tikzpicture}[scale=15]
\draw[->] [thick](-0.22,0) -- (0.78,0);
\draw[step=0.01][very thin, gray] (-0.22,-0.06) grid (0.78,0.06);
\draw (-0.1,0) node [above=5pt, red,fill=white]{$O$};
\draw (-0.1,0) node {$|$};
\draw (0,0) node {$|$};
\draw (0,0) node [below=5pt]{$0$};
\draw (0.1,0) node [above=5pt, red,fill=white]{$P$};
\draw (0.1,0) node {$|$};
\draw (0.1,0) node [below=5pt]{$0,1$};
%le point T
\draw (-0.16,0) node [above=5pt, red,fill=white]{$T$};
\draw (-0.16,0) node {$|$};
\draw (-0.16,0) node [below=5pt, blue,fill=white]{$-0,16\phantom{-}$};
%le point S
\draw (0.7,0) node [above=5pt, red,fill=white]{$S$};
\draw (0.7,0) node {$|$};
\draw (0.7,0) node [below=5pt, blue,fill=white]{$0,7$};
\end{tikzpicture}
\end{center}
\end{enumerate}
\end{document}
答案1
问题是\phantom{-}
每个节点内都有:{$-0,6\phantom{-}$}
。这要求 LaTeX 在数字后留出与字符大小相同的空格_
,这就是为什么负数后会有多余的空格。如果删除命令,\phantom
则会得到:
编辑
要进一步调整标签的位置,使逗号与轴上的标记对齐,您可以加载蒂克兹 positioning
库并在节点上使用定位命令,例如below left=5pt and -12pt
——此处5pt
调整节点标签出现在坐标下方的距离,调整-18pt
向左的距离。这样,经过反复试验找到合适的调整,您可以获得:
这是您的代码,简化为最小工作示例:
\documentclass[11pt,a4paper]{article}
\usepackage{enumitem}
\usepackage{yfonts}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning}
%----------------------------------------------------------%
\begin{document}
\begin{enumerate}[label=\alph*)]
\item les abscisses des points sont en bleu:
\begin{center}
\begin{tikzpicture}[scale=15]
\draw[->] [thick](-0.68,0) -- (0.13,0);
\draw[step=0.01][very thin, gray] (-0.68,-0.06) grid (0.13,0.06);
%le point M
\draw (-0.6,0) node [above=5pt, red,fill=white]{$M$};
\draw (-0.6,0) node {$|$};
\draw (-0.6,0) node [below left=5pt and -12pt, blue,fill=white]{$-0,6$};
\draw (-0.5,0) node {$|$};
%le point N
\draw (-0.4,0) node [above=5pt, red,fill=white]{$N$};
\draw (-0.4,0) node [below left=5pt and -12pt]{$-0,4$};
\draw (-0.4,0) node {$|$};
\draw (-0.3,0) node [below left=5pt and -12pt]{$-0,3$};
\draw (-0.3,0) node {$|$};
\draw (-0.2,0) node {$|$};
%le point 0
\draw (-0.1,0) node [above=5pt, red,fill=white]{$O$};
\draw (-0.1,0) node {$|$};
\draw (-0.1,0) node [below left=5pt and -12pt, blue,fill=white]{$-0,1$};
\draw (0,0) node {$|$};
\draw (0,0) node [below=5pt]{$0$};
%le point P
\draw (0.1,0) node [above=5pt, red,fill=white]{$P$};
\draw (0.1,0) node {$|$};
\draw (0.1,0) node [below=5pt, blue,fill=white]{$0,1$};
\end{tikzpicture}
\end{center}
\item les points S et T :
\begin{center}
\begin{tikzpicture}[scale=15]
\draw[->] [thick](-0.22,0) -- (0.78,0);
\draw[step=0.01][very thin, gray] (-0.22,-0.06) grid (0.78,0.06);
\draw (-0.1,0) node [above=5pt, red,fill=white]{$O$};
\draw (-0.1,0) node {$|$};
\draw (0,0) node {$|$};
\draw (0,0) node [below=5pt]{$0$};
\draw (0.1,0) node [above=5pt, red,fill=white]{$P$};
\draw (0.1,0) node {$|$};
\draw (0.1,0) node [below=5pt]{$0,1$};
%le point T
\draw (-0.16,0) node [above=5pt, red,fill=white]{$T$};
\draw (-0.16,0) node {$|$};
\draw (-0.16,0) node [below left=5pt and -18pt, blue,fill=white]{$-0,16$};
%le point S
\draw (0.7,0) node [above=5pt, red,fill=white]{$S$};
\draw (0.7,0) node {$|$};
\draw (0.7,0) node [below=5pt, blue,fill=white]{$0,7$};
\end{tikzpicture}
\end{center}
\end{enumerate}
\end{document}