commit a218450aa45b12a9a1949350a84b637b1796adaf Author: Juergen Spitzmueller <sp...@lyx.org> Date: Sat Feb 11 09:57:32 2023 +0100
tex2lyx: support documentclass in path (#12284) --- src/tex2lyx/Preamble.cpp | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index fd8e84a..c7e3f73 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -2687,7 +2687,15 @@ void Preamble::parse(Parser & p, string const & forceclass, vector<string> opts = split_options(p.getArg('[', ']')); // FIXME This does not work for classes that have a // different name in LyX than in LaTeX - string const tclass = p.getArg('{', '}'); + string tclass = p.getArg('{', '}'); + if (contains(tclass, '/')) { + // It's considered bad practice, but it is still + // sometimes done (and possible) to enter the documentclass + // as a path, e.g. \documentclass{subdir/class} (#12284) + // we strip the name in this case. + string dummy; + tclass = rsplit(tclass, dummy, '/'); + } p.skip_spaces(); // Only set text class if a class hasn't been forced // (this was set above) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs