Don try to be smart and always protect the preamble with \makeatletter

and \makeatother if it is not empty.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@29854 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2009-05-26 18:07:27 +00:00
parent 10ce509814
commit 27b0a1e35a
2 changed files with 7 additions and 5 deletions

View File

@ -1327,7 +1327,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
lyxpreamble += oss.str();
}
// Will be surrounded by \makeatletter and \makeatother when needed
// Will be surrounded by \makeatletter and \makeatother when not empty
docstring atlyxpreamble;
// Some macros LyX will need
@ -1346,7 +1346,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
+ tmppreamble + '\n';
/* the user-defined preamble */
if (!preamble.empty())
if (preamble.find_first_not_of(" \n\t") != docstring::npos)
// FIXME UNICODE
atlyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
"User specified LaTeX commands.\n"
@ -1403,11 +1403,9 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
if (!bullets_def.empty())
atlyxpreamble += bullets_def + "}\n\n";
if (atlyxpreamble.find(from_ascii("@")) != docstring::npos)
if (!atlyxpreamble.empty())
lyxpreamble += "\n\\makeatletter\n"
+ atlyxpreamble + "\\makeatother\n\n";
else
lyxpreamble += '\n' + atlyxpreamble;
// We try to load babel late, in case it interferes with other packages.
// Jurabib and Hyperref have to be called after babel, though.

View File

@ -72,6 +72,10 @@ What's new
- KDE 4's okular is considered as a viewer for PDF, PS and DVI.
- Revert to pre-1.6 behaviour of always enclosing the preamble between
\makeatletter and \makeatother when exporting to LaTeX and not only
when the @-glyph explicitly appears.
* USER INTERFACE