On Wed, Jan 25, 2017 at 12:33:41PM -0500, Richard Heck wrote: > On 01/25/2017 12:25 PM, Guenter Milde wrote: > > On 2017-01-24, Richard Heck wrote: > >> On 01/24/2017 05:50 PM, Enrico Forestieri wrote: > >>> On Tue, Jan 24, 2017 at 11:31:11PM +0100, Jean-Marc Lasgouttes wrote: > >>>> Le 24/01/2017 à 23:07, Enrico Forestieri a écrit : > >>>>> The first two that come to mind are xypic and tikz. As regards xypic, > >>>>> in lyx 2.1 you could write a code fragment, select it and then hit > >>>>> Ctrl-M to have it nicely previewed. Now no more. > >>>> You mean that hitting Ctrl-M before writing the code fragment does not > >>>> work? > >>> > >> I agree with Enrico that we should revert to the previous behavior. > > However, the previous behavior was changed for a reason (inconsistency > > between LyX GUI and generated output due to the TeX ligatures). I don't > > want this back. > > Yes, but when it was changed, I and others raised exactly these sorts of > concerns---I specifically raised concerns about line-breaking---and we > were told it wouldn't be a problem. It turns out it is a problem. To be > more precise, the conversion from 2.1 to 2.2 breaks some documents > (i.e., they do not give the same output). Some of mine, in particular, > from which I took the original example. > > If the issue is with the display---personally, I don't see the issue, > but if others do---then let's fix the display. There are all kinds of > things that can be done here, e.g., with InsetSpecialChar without > messing up the output. > > I take one of LyX's core principles to be: Don't try to outsmart the > user. That's being violated here.
I think the attached is all is needed here to please everyone. The appearance on screen is the same but we always output "--" and "---", except on text exports where the unicode characters are output. This should ensure maximum compatibility without cluttering the preamble with strange constructs. After all, what matters is the final pdf output and I very much prefer to have "--" and "---" in the latex code rather than \textendash and \textemdash. -- Enrico
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index c1aa2b9..bad4214 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1222,6 +1222,16 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, column += 2; } break; + case 0x2013: + // en-dash + os << "--"; + column +=2; + break; + case 0x2014: + // em-dash + os << "---"; + column +=3; + break; case '\"': os << "\\char`\\\"" << termcmd; column += 9;