Rest in peace, dvipost!

This commit is contained in:
Juergen Spitzmueller 2020-01-13 08:59:26 +01:00
parent e340f46476
commit a450797b2a
10 changed files with 26 additions and 79 deletions

View File

@ -354,7 +354,6 @@
\TestPackage{csquotes} \TestPackage{csquotes}
\TestPackage{drs} \TestPackage{drs}
\TestPackage[koi8-r.def]{cyrillic} \TestPackage[koi8-r.def]{cyrillic}
\TestPackage{dvipost}
\TestPackage{endnotes} \TestPackage{endnotes}
\TestPackage{enotez} \TestPackage{enotez}
\TestPackage{enumitem} \TestPackage{enumitem}

View File

@ -542,7 +542,6 @@ def checkInkscape():
def checkLatex(dtl_tools): def checkLatex(dtl_tools):
''' Check latex, return lyx_check_config ''' ''' Check latex, return lyx_check_config '''
path, LATEX = checkProg('a Latex2e program', ['latex $$i', 'latex2e $$i']) path, LATEX = checkProg('a Latex2e program', ['latex $$i', 'latex2e $$i'])
path, PPLATEX = checkProg('a DVI postprocessing program', ['pplatex $$i'])
#----------------------------------------------------------------- #-----------------------------------------------------------------
path, PLATEX = checkProg('pLaTeX, the Japanese LaTeX', ['platex $$i']) path, PLATEX = checkProg('pLaTeX, the Japanese LaTeX', ['platex $$i'])
if PLATEX: if PLATEX:
@ -556,15 +555,12 @@ def checkLatex(dtl_tools):
PLATEX = '' PLATEX = ''
removeFiles(['chklatex.ltx', 'chklatex.log']) removeFiles(['chklatex.ltx', 'chklatex.log'])
#----------------------------------------------------------------- #-----------------------------------------------------------------
# use LATEX to convert from latex to dvi if PPLATEX is not available
if PPLATEX == '':
PPLATEX = LATEX
if dtl_tools: if dtl_tools:
# Windows only: DraftDVI # Windows only: DraftDVI
addToRC(r'''\converter latex dvi2 "%s" "latex,hyperref-driver=dvips" addToRC(r'''\converter latex dvi2 "%s" "latex,hyperref-driver=dvips"
\converter dvi2 dvi "python -tt $$s/scripts/clean_dvi.py $$i $$o" ""''' % PPLATEX) \converter dvi2 dvi "python -tt $$s/scripts/clean_dvi.py $$i $$o" ""''' % LATEX)
else: else:
addToRC(r'\converter latex dvi "%s" "latex,hyperref-driver=dvips"' % PPLATEX) addToRC(r'\converter latex dvi "%s" "latex,hyperref-driver=dvips"' % LATEX)
# no latex # no latex
if LATEX: if LATEX:
# Check if latex is usable # Check if latex is usable

View File

@ -1,5 +1,5 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/ #LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 588 \lyxformat 592
\begin_document \begin_document
\begin_header \begin_header
\save_transient_properties true \save_transient_properties true
@ -74,6 +74,8 @@
\tablestyle default \tablestyle default
\tracking_changes true \tracking_changes true
\output_changes false \output_changes false
\change_bars false
\postpone_fragile_content false
\html_math_output 0 \html_math_output 0
\html_css_as_file 0 \html_css_as_file 0
\html_be_strict true \html_be_strict true
@ -7904,10 +7906,14 @@ CJKutf8
\end_layout \end_layout
\begin_layout Subsection \begin_layout Subsection
\change_deleted -712698321 1578757015
dvipost dvipost
\end_layout \end_layout
\begin_layout Description \begin_layout Description
\change_deleted -712698321 1578757015
Found: Found:
\begin_inset Info \begin_inset Info
type "package" type "package"
@ -7918,12 +7924,16 @@ arg "dvipost"
\end_layout \end_layout
\begin_layout Description \begin_layout Description
\change_deleted -712698321 1578757015
URL: URL:
\family typewriter \family typewriter
http://freshmeat.net/projects/dvipost/ http://freshmeat.net/projects/dvipost/
\end_layout \end_layout
\begin_layout Description \begin_layout Description
\change_deleted -712698321 1578757015
Notes: Notes:
\family sans \family sans
dvipost dvipost
@ -7940,6 +7950,8 @@ dvipost
\family default \family default
needs te\SpecialChar TeX needs te\SpecialChar TeX
version 2 or newer. version 2 or newer.
\change_unchanged
\end_layout \end_layout
\begin_layout Subsection \begin_layout Subsection

View File

@ -1028,20 +1028,13 @@ bool Buffer::readDocument(Lexer & lex)
readHeader(lex); readHeader(lex);
if (params().output_changes) { if (params().output_changes) {
bool dvipost = LaTeXFeatures::isAvailable("dvipost");
bool xcolorulem = LaTeXFeatures::isAvailable("ulem") && bool xcolorulem = LaTeXFeatures::isAvailable("ulem") &&
LaTeXFeatures::isAvailable("xcolor"); LaTeXFeatures::isAvailable("xcolor");
if (!dvipost && !xcolorulem) { if (!xcolorulem) {
Alert::warning(_("Changes not shown in LaTeX output"), Alert::warning(_("Changes not shown in LaTeX output"),
_("Changes will not be highlighted in LaTeX output, " _("Changes will not be highlighted in LaTeX output, "
"because neither dvipost nor xcolor/ulem are installed.\n" "because xcolor and ulem are not installed.\n"
"Please install these packages or redefine "
"\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
} else if (!xcolorulem) {
Alert::warning(_("Changes not shown in LaTeX output"),
_("Changes will not be highlighted in LaTeX output "
"when using pdflatex, because xcolor and ulem are not installed.\n"
"Please install both packages or redefine " "Please install both packages or redefine "
"\\lyxadded and \\lyxdeleted in the LaTeX preamble.")); "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
} }
@ -3035,20 +3028,13 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
undo().recordUndoBufferParams(CursorData()); undo().recordUndoBufferParams(CursorData());
params().output_changes = !params().output_changes; params().output_changes = !params().output_changes;
if (params().output_changes) { if (params().output_changes) {
bool dvipost = LaTeXFeatures::isAvailable("dvipost");
bool xcolorulem = LaTeXFeatures::isAvailable("ulem") && bool xcolorulem = LaTeXFeatures::isAvailable("ulem") &&
LaTeXFeatures::isAvailable("xcolor"); LaTeXFeatures::isAvailable("xcolor");
if (!dvipost && !xcolorulem) { if (!xcolorulem) {
Alert::warning(_("Changes not shown in LaTeX output"), Alert::warning(_("Changes not shown in LaTeX output"),
_("Changes will not be highlighted in LaTeX output, " _("Changes will not be highlighted in LaTeX output, "
"because neither dvipost nor xcolor/ulem are installed.\n" "because xcolor and ulem are not installed.\n"
"Please install these packages or redefine "
"\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
} else if (!xcolorulem) {
Alert::warning(_("Changes not shown in LaTeX output"),
_("Changes will not be highlighted in LaTeX output "
"when using pdflatex, because xcolor and ulem are not installed.\n"
"Please install both packages or redefine " "Please install both packages or redefine "
"\\lyxadded and \\lyxdeleted in the LaTeX preamble.")); "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
} }

View File

@ -1503,17 +1503,13 @@ void BufferParams::validate(LaTeXFeatures & features) const
features.require("rtloutputdblcol"); features.require("rtloutputdblcol");
if (output_changes) { if (output_changes) {
bool dvipost = LaTeXFeatures::isAvailable("dvipost");
bool xcolorulem = LaTeXFeatures::isAvailable("ulem") && bool xcolorulem = LaTeXFeatures::isAvailable("ulem") &&
LaTeXFeatures::isAvailable("xcolor"); LaTeXFeatures::isAvailable("xcolor");
switch (features.runparams().flavor) { switch (features.runparams().flavor) {
case OutputParams::LATEX: case OutputParams::LATEX:
case OutputParams::DVILUATEX: case OutputParams::DVILUATEX:
if (dvipost) { if (xcolorulem) {
features.require("ct-dvipost");
features.require("dvipost");
} else if (xcolorulem) {
features.require("ct-xcolor-ulem"); features.require("ct-xcolor-ulem");
features.require("ulem"); features.require("ulem");
features.require("xcolor"); features.require("xcolor");

View File

@ -429,10 +429,6 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams,
int column = 0; int column = 0;
bool const dvipost = LaTeXFeatures::isAvailable("dvipost") &&
(runparams.flavor == OutputParams::LATEX
|| runparams.flavor == OutputParams::DVILUATEX);
if (oldChange.type != Change::UNCHANGED) { if (oldChange.type != Change::UNCHANGED) {
if (oldChange.type != Change::DELETED || runparams.ctObject != OutputParams::CT_OMITOBJECT) { if (oldChange.type != Change::DELETED || runparams.ctObject != OutputParams::CT_OMITOBJECT) {
// close \lyxadded or \lyxdeleted // close \lyxadded or \lyxdeleted
@ -440,7 +436,7 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams,
column++; column++;
} }
if (oldChange.type == Change::DELETED if (oldChange.type == Change::DELETED
&& !runparams.wasDisplayMath && !dvipost) && !runparams.wasDisplayMath)
--runparams.inulemcmd; --runparams.inulemcmd;
} }
@ -461,7 +457,7 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams,
macro_beg = from_ascii("\\lyxudisplayobjdeleted"); macro_beg = from_ascii("\\lyxudisplayobjdeleted");
else { else {
macro_beg = from_ascii("\\lyxdeleted"); macro_beg = from_ascii("\\lyxdeleted");
if (!runparams.inDisplayMath && !dvipost) if (!runparams.inDisplayMath)
++runparams.inulemcmd; ++runparams.inulemcmd;
} }
} }

View File

@ -235,29 +235,6 @@ static docstring const lyxdot_def = from_ascii(
"%% A simple dot to overcome graphicx limitations\n" "%% A simple dot to overcome graphicx limitations\n"
"\\newcommand{\\lyxdot}{.}\n"); "\\newcommand{\\lyxdot}{.}\n");
static docstring const changetracking_dvipost_def = from_ascii(
"%% Change tracking with dvipost\n"
"\\dvipostlayout\n"
"\\dvipost{osstart color push Red}\n"
"\\dvipost{osend color pop}\n"
"\\dvipost{cbstart color push Blue}\n"
"\\dvipost{cbrule 0pt}\n"
"\\dvipost{cbend color pop}\n"
"\\DeclareRobustCommand{\\lyxadded}[4][]{\\changestart#4\\changeend}\n"
"\\DeclareRobustCommand{\\lyxdeleted}[4][]{%\n"
"\\changestart\\overstrikeon#4\\overstrikeoff\\changeend}\n");
static docstring const changetracking_dvipost_cb_def = from_ascii(
"%% Change tracking with dvipost\n"
"\\dvipostlayout\n"
"\\dvipost{osstart color push Red}\n"
"\\dvipost{osend color pop}\n"
"\\dvipost{cbstart color push Blue}\n"
"\\dvipost{cbend color pop}\n"
"\\DeclareRobustCommand{\\lyxadded}[4][]{\\changestart#4\\changeend}\n"
"\\DeclareRobustCommand{\\lyxdeleted}[4][]{%\n"
"\\changestart\\overstrikeon#4\\overstrikeoff\\changeend}\n");
static docstring const changetracking_xcolor_ulem_base_def = from_ascii( static docstring const changetracking_xcolor_ulem_base_def = from_ascii(
"%% Change tracking with ulem and xcolor: base macros\n" "%% Change tracking with ulem and xcolor: base macros\n"
"\\DeclareRobustCommand{\\mklyxadded}[1]{\\bgroup\\color{lyxadded}{}#1\\egroup}\n" "\\DeclareRobustCommand{\\mklyxadded}[1]{\\bgroup\\color{lyxadded}{}#1\\egroup}\n"
@ -1131,7 +1108,6 @@ char const * simplefeatures[] = {
"float", "float",
"wrapfig", "wrapfig",
"booktabs", "booktabs",
"dvipost",
"fancybox", "fancybox",
"calc", "calc",
"units", "units",
@ -1306,7 +1282,7 @@ string const LaTeXFeatures::getPackages() const
// The rest of these packages are somewhat more complicated // The rest of these packages are somewhat more complicated
// than those above. // than those above.
if (mustProvide("changebar") && !mustProvide("ct-dvipost")) { if (mustProvide("changebar")) {
packages << "\\usepackage"; packages << "\\usepackage";
if (runparams_.flavor == OutputParams::LATEX if (runparams_.flavor == OutputParams::LATEX
|| runparams_.flavor == OutputParams::DVILUATEX) || runparams_.flavor == OutputParams::DVILUATEX)
@ -1753,13 +1729,6 @@ TexString LaTeXFeatures::getMacros() const
macros << lyxref_def << '\n'; macros << lyxref_def << '\n';
// change tracking // change tracking
if (mustProvide("ct-dvipost")) {
if (isRequired("changebar"))
macros << changetracking_dvipost_cb_def;
else
macros << changetracking_dvipost_def;
}
if (mustProvide("ct-xcolor-ulem")) { if (mustProvide("ct-xcolor-ulem")) {
streamsize const prec = macros.os().precision(2); streamsize const prec = macros.os().precision(2);

View File

@ -1101,8 +1101,7 @@ void InsetMathHull::validate(LaTeXFeatures & features) const
+ bgcol + "}{\\ensuremath{\\mathtt{#1}}}}"); + bgcol + "}{\\ensuremath{\\mathtt{#1}}}}");
features.addPreambleSnippet( features.addPreambleSnippet(
from_ascii("\\newcommand{\\endregexp}{}")); from_ascii("\\newcommand{\\endregexp}{}"));
} else if (outerDisplay() && features.inDeletedInset() } else if (outerDisplay() && features.inDeletedInset()) {
&& !features.mustProvide("ct-dvipost")) {
features.require("tikz"); features.require("tikz");
features.require("ct-tikz-object-sout"); features.require("ct-tikz-object-sout");
} }

View File

@ -357,10 +357,7 @@ void InsetMathNest::latex(otexstream & os, OutputParams const & runparams) const
WriteStream wi(os, runparams.moving_arg, true, WriteStream wi(os, runparams.moving_arg, true,
runparams.dryrun ? WriteStream::wsDryrun : WriteStream::wsDefault, runparams.dryrun ? WriteStream::wsDryrun : WriteStream::wsDefault,
runparams.encoding); runparams.encoding);
wi.strikeoutMath(runparams.inDeletedInset wi.strikeoutMath(runparams.inDeletedInset);
&& (!LaTeXFeatures::isAvailable("dvipost")
|| (runparams.flavor != OutputParams::LATEX
&& runparams.flavor != OutputParams::DVILUATEX)));
if (runparams.inulemcmd) { if (runparams.inulemcmd) {
wi.ulemCmd(WriteStream::UNDERLINE); wi.ulemCmd(WriteStream::UNDERLINE);
if (runparams.local_font) { if (runparams.local_font) {

View File

@ -4076,7 +4076,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
os << "\n\\change_deleted "; os << "\n\\change_deleted ";
os << author.bufferId() << ' ' << ptime << '\n'; os << author.bufferId() << ' ' << ptime << '\n';
parse_text_snippet(p, os, FLAG_ITEM, outer, context); parse_text_snippet(p, os, FLAG_ITEM, outer, context);
bool dvipost = LaTeXPackages::isAvailable("dvipost");
bool xcolorulem = LaTeXPackages::isAvailable("ulem") && bool xcolorulem = LaTeXPackages::isAvailable("ulem") &&
LaTeXPackages::isAvailable("xcolor"); LaTeXPackages::isAvailable("xcolor");
// No need to test for luatex, since luatex comes in // No need to test for luatex, since luatex comes in
@ -4089,9 +4088,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
preamble.registerAutomaticallyLoadedPackage("pdfcolmk"); preamble.registerAutomaticallyLoadedPackage("pdfcolmk");
} }
} else { } else {
if (dvipost) { if (xcolorulem) {
preamble.registerAutomaticallyLoadedPackage("dvipost");
} else if (xcolorulem) {
preamble.registerAutomaticallyLoadedPackage("ulem"); preamble.registerAutomaticallyLoadedPackage("ulem");
preamble.registerAutomaticallyLoadedPackage("xcolor"); preamble.registerAutomaticallyLoadedPackage("xcolor");
} }