diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index ee39e6a518..fa8bb4140b 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1957,8 +1957,9 @@ bool Paragraph::latex(Buffer const & buf, open_font = false; } - // Switch file encoding if necessary - if (runparams.encoding->package() == Encoding::inputenc && + // Switch file encoding if necessary (and allowed) + if (!runparams.verbatim && + runparams.encoding->package() == Encoding::inputenc && font.language()->encoding()->package() == Encoding::inputenc) { std::pair const enc_switch = switchEncoding(os, bparams, runparams.moving_arg, *(runparams.encoding), diff --git a/src/output_latex.cpp b/src/output_latex.cpp index bf04a243c3..92c1ca77d5 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -253,6 +253,18 @@ TeXOnePar(Buffer const & buf, BufferParams const & bparams = buf.params(); LayoutPtr style; + if (runparams_in.verbatim) { + Font const outerfont = + outerFont(std::distance(paragraphs.begin(), pit), + paragraphs); + // FIXME UNICODE + bool need_par = pit->latex(buf, bparams, outerfont, + os, texrow, runparams_in); + os << '\n'; + texrow.newline(); + return ++pit; + } + // In an inset with unlimited length (all in one row), // force layout to default if (!pit->forceDefaultParagraphs()) @@ -558,7 +570,7 @@ TeXOnePar(Buffer const & buf, if (closing_rtl_ltr_environment) os << "}"; - if (pending_newline && !runparams.verbatim) { + if (pending_newline) { os << '\n'; texrow.newline(); }