Anzeige:
Ergebnis 1 bis 4 von 4

Thema: place equation in desired position

  1. #1
    Registrierter Benutzer
    Registriert seit
    16.01.2007
    Beiträge
    7

    Lightbulb place equation in desired position

    hallo there,

    I am just woundering, whether there is a way to place an equation in a desired position, let's say, 5cm from left.

    thanks for any help.

    Yang

  2. #2
    Registrierter Benutzer Avatar von countbela666
    Registriert seit
    15.04.2005
    Ort
    Berlin
    Beiträge
    2.317
    Hi Yang,

    here's a short example that only works with the fleqn class option:
    Code:
    \documentclass[fleqn,english]{article}
    \usepackage{babel,blindtext,amsmath}
    \begin{document}
      \blindtext
      {\mathindent=5cm
      \begin{align}
        a^2+b^2&=c^2 \qquad\text{5\,cm from left}\\
        d&=e
      \end{align}}
      %
      \blindtext
      {\mathindent=0cm
      \begin{align}
        a^2+b^2&=c^2 \qquad\text{0\,cm from left}\\
        d&=e
      \end{align}}
      %
      \blindtext
      \begin{align}
        a^2+b^2&=c^2 \qquad\text{normal flushleft}\\
        d&=e
      \end{align}
      \blindtext
    \end{document}
    Regards
    Marcel

    Listen to me children of the night, beyond the doors of darkness you will find
    a thousand worlds for you to see here, take my hand and follow me...

  3. #3
    Registrierter Benutzer
    Registriert seit
    16.01.2007
    Beiträge
    7

    Lightbulb

    hallo Marcel,

    thanks soooooooooo much, that was great help.

    but the problem is I just want change only some of the equations in the desired place, other remain centering. Using \mathindent changed all the equations to be placed, for example, 5cm from left.

    I tried to add \centering in the front of other equations, but it didnt work.

    anyone can help me?

    thanks...

  4. #4
    Registrierter Benutzer Avatar von rais
    Registriert seit
    18.07.2005
    Beiträge
    5.862
    Hi Yang,
    Zitat Zitat von Yang Beitrag anzeigen
    but the problem is I just want change only some of the equations in the desired place, other remain centering. Using \mathindent changed all the equations to be placed, for example, 5cm from left.
    well, the environments shown here---except equation, that is---aren't usually taken for single lined equations, and some strange things may happen if you have some different heights or try leqno/fleqn, but as an idea...
    Code:
    \documentclass{article}
    \usepackage{amsmath}
    \newlength{\ieqind}
    \newenvironment{indeq}[1][2cm]{%
      \setlength{\ieqind}{#1}
      \addtolength{\ieqind}{-\multlinegap}
      \multline%
      \hspace{\ieqind}
    }{
      \\[-\baselineskip]\endmultline%
    }
    \begin{document}
    \begin{equation}
    c^2 = a^2 + b^2
    \end{equation}
    \noindent\rule{2cm}{1pt}
    \begin{indeq}
    c^2 = a^2 + b^2
    \end{indeq}
    \noindent\rule{2cm}{1pt}
    \begin{flalign*}
    \hspace{2cm}c^2 &= a^2 + b^2
     & \vphantom{a}&\phantom{=}\vphantom{b}
    \end{flalign*}
    \end{document}
    Similarily, you could use the flalign-environment for a numbered version, should my indeq environment give you too much trouble;-)
    To make the difference more apparent, I used 2 cm, instead of 5... but that is easily adapted.
    Regards,
    Rainer
    There's nothing a good whack with a hammer won't fix!

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •