TransWikia.com

alignment, justifying text

TeX - LaTeX Asked by Fanny Mae on December 7, 2020

I am trying to make a file with all exercises i have and i encounter some justifying problems with some lines. I am using MikTex with TexMaker (5.0.3). Here is my code :

%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]{raggedrightmbox{frakfamilyfraklinesyinipar{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}
noindentbegin{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}

%les exercices
noindentbegin{cursive}Exercice no 13 p29: placer les points dans le repèreend{cursive}

begin{center}
    begin{tikzpicture}
        draw (0,0) node {$bullet$};
        draw (0,0) node[below left]{$O$};
        draw[->] (-4,0) -- (0,0) -- (5,0);
        draw (1,0) node {$bullet$};
        draw (1,0) node [below]{$1$};
        draw[->] (0,-4.5) --(0,0) -- (0,2);
        draw (0,1) node {$bullet$};
        draw (0,1) node[left]{$1$};
%le point A(-3,-4)
        draw [dashed] (-3,-4) -- (-3,0) node[above] {$-3$};
        draw [dashed] (-3,-4) -- (0,-4) node[right] {$-4$};
        draw (-3,-4) node[below left]{$A(-3,-4)$};
        fill[green] (-3,-4) node{$bullet$};
%le point B(4,-2)
        draw [dashed] (4,-2) -- (4,0) node[above] {$4$};
        draw [dashed] (4,-2) -- (0,-2) node[left] {$-2$};
        draw (4,-2) node[below right]{$B(4,-2)$};
        fill[orange] (4,-2) node{$bullet$};
%le point C(3,-2)
        draw [dashed] (3,-2) -- (3,0) node[above] {$3$};
        draw [dashed] (3,-2) -- (0,-2) node[left] {$-2$};
        draw (3,-2) node[above left]{$C(3,-2)$};
        fill[cyan] (3,-2) node{$bullet$};
%le point D(2,1)
        draw [dashed] (2,1) -- (2,0) node[below] {$2$};
        draw [dashed] (2,1) -- (0,1) node[left] {$1$};
        draw (2,1) node[above right]{$D(2,1)$};
        fill[blue] (2,1) node{$bullet$};
%le point E(-2,-3)
        draw [dashed] (-2,-3) -- (-2,0) node[above] {$-2$};
        draw [dashed] (-2,-3) -- (0,-3) node[right] {$-3$};
        draw (-2,-3) node[below]{$E(-2,-3)$};
        fill[red] (-2,-3) node{$bullet$};
    end{tikzpicture}
end{center}

vspace{1cm}

noindentbegin{cursive}Exercice no 7 p28: placer les points sur la droiteend{cursive}

begin{center}
    begin{tikzpicture}[scale=4]
        draw[->] [ultra thick] (-6.4,0) -- (-3.4,0);
        draw[step=0.1][very thin, gray] (-6.52,-0.24) grid (-3.18,0.24);
        draw (-5,0) node [above=1.2mm,fill=white]{$-5phantom{-}$};
        draw (-5,0) node {$|$};
        draw (-4.5,0) node [above=1.2mm,fill=white]{$-4.5phantom{-}$};
        draw (-4.5,0) node {$|$};
        draw (-4,0) node[above=1.2mm,fill=white]{$-4phantom{-}$};
        draw (-4,0) node {$|$};

        %placement d'un tiret à l'abscisse -4.5
        %node at (-4.5,0) {$|$};

%le point A(-6,0)
        draw (-6,0) node[above=5pt,fill=white]{$A(-6)$};
        fill[orange] (-6,0) node{$bullet$};
%le point B(-5.6,0)
        draw (-5.6,0) node[below=1.2mm,fill=white]{$B(-5.6)$};
        fill[blue] (-5.6,0) node{$bullet$};
%le point C(-4.8,0)
        draw (-4.8,0) node[below=1.3mm,fill=white]{$C(-4.8)$};
        fill[red] (-4.8,0) node{$bullet$};
%le point D(-3.8,0)
        draw (-3.8,0) node[below=3pt,fill=white]{$D(-3.8)$};
        fill[green] (-3.8,0) node{$bullet$};
%le point E(-3.6,0)
        draw (-3.6,0) node[above=5pt,fill=white]{$E(-3.6)$};
        fill[cyan] (-3.6,0) node{$bullet$};
    end{tikzpicture}
end{center}

newpage

noindentbegin{cursive}Exercice no 9 p176:end{cursive}

begin{center}
    begin{tikzpicture}[scale=1.5]  
        draw[->] [thick] (-5.5,0) -- (3.5,0);
        draw (-5,0) node [below=5pt]{$-5phantom{-}$};
        draw (-4,0) node [below=5pt]{$-4phantom{-}$};
        draw (-3,0) node [below=5pt]{$-3phantom{-}$}; 
        draw (-2,0) node [below=5pt]{$-2phantom{-}$};     
        draw (-1,0) node [below=5pt]{$-1phantom{-}$};
        draw (0,0) node [below=5pt, red]{$0$};
        node at (0,0) {$|$};
        draw (1,0) node [below=5pt]{$1$};
        draw (2,0) node [below=5pt]{$2$};      
        node at (2,0) {$|$};
        draw (3,0) node [below=5pt]{$3$};  
        node at (3,0) {$|$};
%le point F(-5,0)
        draw (-5,0) node[above=5pt, rose]{$F$};
        fill[rose] (-5,0) node{$times$};
%le point G(-4,0)
        draw (-4,0) node[above=5pt, shamrockgreen]{$G$};
        fill[shamrockgreen] (-4,0) node{$times$};
%le point O(-3,0)
        draw (-3,0) node[above=5pt, richlavender]{$O$};
        fill[richlavender] (-3,0) node{$times$};
%le point I(-2,0)
        draw (-2,0) node[above=5pt, red]{$I$};
        fill[red] (-2,0) node{$times$};
%le point M(-1,0)
        draw (-1,0) node[above=5pt, tangelo]{$M$};
        fill[tangelo] (-1,0) node{$times$};
%le point S(1,0)
        draw (1,0) node[above=5pt, blue]{$S$};
        fill[blue] (1,0) node{$times$};
    end{tikzpicture}
end{center}

begin{enumerate}[label=alph*)]

item $OF = IG = OM = MS = 2$

item $begin{aligned}[t]
    &OI &=1 \
    &OM &=2 \
    &GS &=5 \
    &MG &=3
end{aligned}$

item calcul des distances $GS$ et $MF$
newline
$OM = MS$ donc $GS = GM + OM = GM + MS$
newline
$OM = OF$ donc $MF = MO + OF = 2.MO$
end{enumerate}

vspace{1cm}

noindentbegin{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,6phantom{-}$};
            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,4phantom{-}$};
            draw (-0.4,0) node {$|$};
            draw (-0.3,0) node [below=5pt]{$-0,3phantom{-}$};
            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,1phantom{-}$};
            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,16phantom{-}$};
    %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}

newpage

%exemples de tableau
noindentbegin{cursive}Des tableaux:end{cursive}
begin{table}[h!]
    begin{center}

    label{tab:table1}
        
        begin{tabular}{l|c|r} % Alignements: left, center, right
            textbf{Val 1} & textbf{Val 2} & textbf{Val 3}\
            $alpha$ & $beta$ & $gamma$ \
            hline
            1 & 1110.1 & a\
            2 & 10.1 & b\
            3 & 23.113231 & c\
        end{tabular}
    caption{Valeurs basiques}

vspace{1cm}    

    label{tab:table2}
    
    begin{tabular}{l|S|r} % c devient S ==> unitsx
        textbf{Val 1} & textbf{Val 2} & textbf{Val 3}\
        $alpha$ & $beta$ & $gamma$ \
        hline
        1 & 1110.1 & a\
        2 & 10.1 & b\
        3 & 23.113231 & c\
    end{tabular}
  caption{Valeurs alignées et arrondies}
  
    end{center}
  end{table}

%exemples d'équation
noindentbegin{cursive}Des équations:end{cursive}
begin{gather*}
2x - 5y =  8 \
3x^2 + 9y =  3a + c
end{gather*}
begin{align*}
2x - 5y &=  8 \
3x + 9y &=  -12
end{align*}
begin{align*}
x&=y           &  w&=z               &  a&=b+c\
2x&=-y         &  3w&=frac{1}{2}z   &  a&=b\
-4 + 5x&=2+y   &  w+2&=-1+w          &  ab&=cb
end{align*}



end{document}

and here is the result i have with :

enter image description here

MATHEMATIQUES and the next line should be vertically aligned but there is like a small indent on the second line even when i put the noindent switch.
Also thevspace is not understood (i removed it and put it back) while i did opposite with newline : vspace is useless.

how can i align these lines ?
if problem is the font choice as suggered by Denis, do i have to replace with same fonts everywhere ?

thank you for help.

One Answer

In the following example, I have used setlength{parindent} in order to globally remove the indentation. Thus, there is no need to repeat noindent over and over. Also, I have replaced newline vspace{1cm} with a simple empty line.With these changes, you get the following output:

enter image description here

documentclass[11pt,a4paper]{article}

usepackage[T1]{fontenc}
usepackage[french]{babel} %pour le symbole n°
frenchbsetup{StandardLists=true} % pour les listes avec enumitem : à inclure si on utilise 


usepackage{frcursive}
usepackage{yfonts}
usepackage{amsmath}

setlength{parindent}{0pt}

%----------------------------------------------------------%
begin{document}
MATH'EMATIQUES

begin{cursive}Un exemple de repère:end{cursive}

end{document}

Correct answer by leandriis on December 7, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP