On Sun, Oct 16, 2016 at 11:27:02PM -0400, Scott Kostyshak wrote:

> On Mon, Oct 17, 2016 at 04:00:25AM +0200, Enrico Forestieri wrote:
> > commit 261e7ae9ce7e6a1ffc4932ff9c33107588a9a4ac
> > Author: Enrico Forestieri <for...@lyx.org>
> > Date:   Mon Oct 17 03:25:35 2016 +0200
> > 
> >     Strike out (in the output) deleted display math with track-changes
> 
> Nice!
> 
> Did this commit fix #9678?

Yes, it does. I was missing that bug.

> I tested it out and have a couple of questions. Attached is a file. If I
> compile I get an error ("there's no line to end here"). If I put the
> cursor at the end of "hello" and press (forward) delete to remove the
> newline (nothing changes on the screen) and then compile, there is no
> error.

Fixed at c1bfaa5c.

> A second question is: Is the diagonal line supposed to be so large?
> Screenshot attached.

Yes, unfortunately. There is no way (that I know of) for determing the
width occupied by displayed math, However, one can redefine \lyxmathsout
and customize the width of the line case by case. See the attached first
example. Maybe that hook should be provided by default?

I also explored other different ways for striking out displayed math.
I like very much method 1 in the second attached example. However, it is
more complicated to automate in LyX. Maybe I could do that when I find
the necessary time and introduce some preference for choosing the way
display math is striked out. But don't hold your breath while waiting ;-)

-- 
Enrico
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 513
\begin_document
\begin_header
\save_transient_properties true
\origin /c/work/
\textclass article
\begin_preamble
\newcommand{\stoff}{2em}
\renewcommand{\lyxmathsout}[1]{
  \tikz[baseline=(math.base)]{
    \node[inner sep=0pt,outer sep=0pt](math){#1};
    \draw($(math.south west)+(\stoff,.5em)$)--($(math.north 
east)-(\stoff,.5em)$);
  }
}
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\graphics default
\default_output_format default
\output_sync 1
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes true
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\author 5863344 "ef"
\author 274215730 "scott"
\end_header

\begin_body

\begin_layout Standard
hello
\end_layout

\begin_layout Standard

\change_deleted 274215730 1476673996
\begin_inset Formula 
\[
x+y
\]

\end_inset


\change_unchanged
testing now
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
renewcommand
\backslash
stoff{16em}
\end_layout

\end_inset


\change_deleted 5863344 1476722748

\begin_inset Formula 
\[
x+y
\]

\end_inset


\change_unchanged

\end_layout

\end_body
\end_document
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\begin_preamble
\usepackage{ifpdf}
\ifpdf\else\usepackage[normalem]{ulem}\fi

%% For not showing deletions and underlining insertions, activate
%% "Show Changes in Output" and uncomment the following lines:
%\usepackage[normalem]{ulem}
%\setlength{\ULdepth}{0.25\baselineskip}
%\let\oldcite\cite
%\def\newcite#1{\mbox{\oldcite{#1}}}
%\def\lyxadded#1#2#3{\let\cite\newcite\uline{#3}\let\cite\oldcite}
%\def\lyxdeleted#1#2#3{}

% In order to distinguish underline and strike out
\ifcsname oldcite\endcsname\else\def\normalct{}\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Method 1:
% To strike out pieces of a formula in display mode
\def\msout#1{\mbox{\sout{$\displaystyle #1$}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Method 2:
% To strike out a whole formula in display mode
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\dcancel}[1]{
  \tikz[baseline=(math.base)]{
    \node[inner sep=0pt,outer sep=0pt](math){#1};
    \draw[red]($(math.south west)+(5em,.5em)$)--($(math.north 
east)-(5em,.5em)$);
    % Uncomment the following line for a crossbuck sign
    %\draw[red]($(math.north west)+(5em,-.5em)$)--($(math.south 
east)-(5em,-.5em)$);
  }
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 12
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes true
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\author 5863344 "ef"
\end_header

\begin_body

\begin_layout Standard
See the preamble for how not showing deletions and underlining new insertions.
 This manual markup is necessary for deleted formulas in 
\emph on
display mode
\emph default
 when using old versions of LyX.
 Choose one of the following two methods.
 The third method is equivalent to the second one, but is automatically
 performed by recent LyX versions (it fails for LyX versions less than 2.3.0).
 The first method is aesthetically more pleasant but requires more work
 when using the 
\family typewriter
align
\family default
 environment, because each array cell has to be put in 
\family typewriter

\backslash
msout
\family default
.
 Instead, using the second (or third) one, it suffices inserting a 
\family typewriter

\backslash
tag
\family default
 containing 
\family typewriter

\backslash
sout{<old
\begin_inset space \thinspace{}
\end_inset

eqnum>}
\family default
 (see the preamble for how to get a crossbuck sign instead of a diagonal
 line only).
\end_layout

\begin_layout Subsubsection*
Method 1
\end_layout

\begin_layout Standard
The following 
\change_deleted 5863344 1476024654
eqaution
\change_inserted 5863344 1476024656
equation
\change_unchanged
 has been canceled
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
ifcsname lyxdeleted
\backslash
endcsname
\backslash
ifcsname normalct
\backslash
endcsname
\backslash
textcolor{red}{
\end_layout

\end_inset


\begin_inset Formula 
\begin{align}
\msout{y} & \msout{=\int_{a}^{b}f(x)dx}\tag{\sout{1-old}}\\
\msout{z} & \msout{=g(x)}\tag{\sout{2-old}}
\end{align}

\end_inset


\begin_inset ERT
status open

\begin_layout Plain Layout

}
\backslash
fi
\backslash
fi 
\end_layout

\end_inset

Continue with correct numbering
\begin_inset Formula 
\begin{equation}
y=f(x)
\end{equation}

\end_inset


\end_layout

\begin_layout Subsubsection*
Method 2
\end_layout

\begin_layout Standard
The following 
\change_deleted 5863344 1476026261
eqaution
\change_inserted 5863344 1476026262
equation
\change_unchanged
 has been canceled
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
ifcsname lyxdeleted
\backslash
endcsname
\backslash
ifcsname normalct
\backslash
endcsname
\end_layout

\begin_layout Plain Layout


\backslash
par
\backslash
noindent
\backslash
dcancel{
\backslash
parbox{
\backslash
columnwidth}{
\backslash
color{red}
\end_layout

\end_inset


\begin_inset Formula 
\begin{align}
y & =\int_{a}^{b}f(x)dx\tag{\sout{1-old}}\\
z & =g(x)\tag{\sout{2-old}}
\end{align}

\end_inset


\begin_inset ERT
status open

\begin_layout Plain Layout

}}
\backslash
fi
\backslash
fi 
\end_layout

\end_inset

Continue with correct numbering
\begin_inset Formula 
\begin{equation}
y=f(x)
\end{equation}

\end_inset


\end_layout

\begin_layout Subsubsection*
Method 3 (same as 2, but automatically done by LyX 
\begin_inset Formula $\ge$
\end_inset

 2.3)
\begin_inset Note Note
status open

\begin_layout Plain Layout
In old versions, this only works with dvi output, and only if dvipost is
 available.
 A pdf output can be nevertheless obtained by using the ps2pdf or dvipdfm
 route.
\end_layout

\end_inset


\end_layout

\begin_layout Standard
The following 
\change_deleted 5863344 1476572493
eqaution
\change_inserted 5863344 1476572494
equation
\change_unchanged
 has been canceled
\change_deleted 5863344 1476572521

\begin_inset Formula 
\begin{align}
y & =\int_{a}^{b}f(x)dx\tag{\sout{1-old}}\\
z & =g(x)\tag{\sout{2-old}}
\end{align}

\end_inset


\change_unchanged
Continue with correct numbering
\begin_inset Formula 
\begin{equation}
y=f(x)
\end{equation}

\end_inset


\end_layout

\end_body
\end_document

Reply via email to