2

A MWE is as follows:

\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{logicproof}
\usepackage{etoolbox}
%%%make logic proof lines ragged left%%%%%%%%%%%%%%%%%%%
\patchcmd{\logicproof}{\center}{\flushleft}{}{}
\patchcmd{\endlogicproof}{\endcenter}{\endflushleft}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{logicproof}{1}
        \forall x \, (P(x) \to Q(x)) & premise \label{cxy}\\
        \forall x \, P(x) & premise \\
        P(x_0) \to Q(x_0) & $\forall x \, \mathrm{e}$ 1 \\
        P(x_0) & $\forall x \, \mathrm{e}$ 2 \\
        Q(x_0) & $\to \mathrm{e}$ 3, 4 and so on \eqref{cxy}\\
        \forall x \, Q(x) & $\forall x \, \mathrm{i}$ 3--5
\end{logicproof}
\end{document}

And its output is

enter image description here

My QUESTION is how to make the lines numbers of logic proofs be added parentheses, such as (1), (2), (3) and so on?I tried several times but unfortunately failed.

Any reply is welcome!

1 Answer 1

3

The macro that holds the format of the line number in the proofs is \lp@start@proof@line. You only need to redefine it:

\renewcommand{\lp@start@proof@line}{%
  \stepcounter{lp@line}%
  (\arabic{lp@line})%
  &%
  \lp@continue@proof@line%
}

enter image description here

\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{logicproof}
\usepackage{etoolbox}
%%%make logic proof lines ragged left%%%%%%%%%%%%%%%%%%%
\patchcmd{\logicproof}{\center}{\flushleft}{}{}
\patchcmd{\endlogicproof}{\endcenter}{\endflushleft}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeatletter
\renewcommand{\lp@start@proof@line}{%
  \stepcounter{lp@line}%
  (\arabic{lp@line})%
  &%
  \lp@continue@proof@line%
}
\makeatother

\begin{document}
\begin{logicproof}{1}
        \forall x \, (P(x) \to Q(x)) & premise \label{cxy}\\
        \forall x \, P(x) & premise \\
        P(x_0) \to Q(x_0) & $\forall x \, \mathrm{e}$ 1 \\
        P(x_0) & $\forall x \, \mathrm{e}$ 2 \\
        Q(x_0) & $\to \mathrm{e}$ 3, 4 and so on \eqref{cxy}\\
        \forall x \, Q(x) & $\forall x \, \mathrm{i}$ 3--5
\end{logicproof}
\end{document}
6
  • By the way, how do you read your surname "Oleinik"?
    – M. Logic
    Nov 24, 2022 at 15:04
  • @M.Logic More or less like it's written, with stress on “lei”. Google translate's pronunciation for “Olejnik” in Polish is pretty accurate (my last name is of Polish origin). Nov 25, 2022 at 1:18
  • O read as in so or as in off?
    – M. Logic
    Nov 25, 2022 at 1:42
  • @M.Logic If I had to choose, I'd pick “so” (definitely not “off”), but it's shorter, more like the “o” in “word”. Mind if I ask why you want to know? (I'm getting curious on your curiosity :) Nov 25, 2022 at 2:26
  • I'd like to show thanks to people who help me a lot on latex when writing my book, and I need to translate it into Chinese from the exact sound of surname. I see, so it pronounced [ɔ]?
    – M. Logic
    Nov 25, 2022 at 2:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .