3

I wanted to center align two logical equations that do not use "=" sign. I also want to separate the equations with a line. Currently I use aligned environment and midrule. Can the equations be center aligned instead of right aligned? The minimum working example is given below:

\documentclass[border=3mm,preview]{standalone}
\usepackage{amsmath}
\usepackage{booktabs}

\begin{document}

    \begin{equation*}
    \begin{aligned}
        \forall_{t \in firing} \quad \forall_{a \in t \bullet} \quad a \in AN\\
        \midrule
        \mu^\prime_{an} = (\mu_{an} - \bullet t) \cup a, \quad c(a) = 0 \\
    \end{aligned}
    \end{equation*}
\end{document}

enter image description here

2
  • What shall be aligned here actually? Wouldn't alignat* not better than a combination of equation* and aligned?
    – user31729
    Jan 26, 2017 at 16:01
  • @ChristianHupfer - The OP may have used some unintentionally ambiguous terminology. Instead of "center aligned", it might be more felicitous to simply write "center".
    – Mico
    Jan 26, 2017 at 16:09

2 Answers 2

5

You could replace the aligned environment with a gathered environment, which centers its contents line by line.

\documentclass[border=3mm,preview]{standalone}
\usepackage{amsmath}
\usepackage{booktabs}
\begin{document}
    \begin{equation*}
    \begin{gathered} % 'gathered' instead of 'aligned'
        \forall_{t \in \textit{firing}} \quad \forall_{a \in t \bullet} \quad a \in AN\\
        \midrule
        \mu^\prime_{an} = (\mu_{an} - \bullet t) \cup a, \quad c(a) = 0 
    \end{gathered}
    \end{equation*}
\end{document}
1
  • it works with gathered.
    – raman
    Jan 27, 2017 at 4:58
5

I hope you understand your question. I add my MWE centering two logical equations without equal sign and separate the equations with a line.

enter image description here

\documentclass[a4paper]{article}
\usepackage{amsmath,amssymb,booktabs}
\begin{document}

$\begin{array}{@{}c@{}}
\forall_{t\in\mathit{firing}} \quad \forall_{a\in t\bullet} \quad a\in AN \\
\specialrule{.05em}{1em}{0em}\\
\mu'_{an} = (\mu_{an} - \bullet t) \cup a, \quad c(a) = 0 \\[.5em]
\specialrule{.2em}{.1em}{.1em} % optional
\end{array}$

\end{document}

enter image description here

4
  • Instead of using \multicolumn{4}{c}{$...$} for both rows, would it maybe be easier not to employ \begin{tabular}{llll} ... \end{tabular} and, instead, to employ $\begin{array}{c} ... \end{array}$?
    – Mico
    Jan 27, 2017 at 9:11
  • You're right. When I entered the code I have not thought about it much. Compared much who is better than me. You can, if you like, change my code.
    – Sebastiano
    Jan 27, 2017 at 16:38
  • I've taken you up on the invitation to modify your code. Feel free to apply further changes.
    – Mico
    Jan 27, 2017 at 21:06
  • @Mico Perfect. This way I learn new codes and shortcuts. Thanks a lot.
    – Sebastiano
    Jan 28, 2017 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.