mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 10:47:57 +00:00
* src/Spacing.cpp (writeBeginEnv, writeEndEnv): add a bool parameter
directing to use memoir's capitalized latex macros. * src/LaTeXFeatures.cpp (getPackages): act on feature "SetSpace". * src/output_latex.cpp (TeXOnePar): ditto * lib/layouts/memoir.layout: provide feature SetSpace, indicating that memoir provides the setspace functionality, but with a different syntax. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22551 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c15b2f6e1a
commit
3d8828fa14
@ -15,6 +15,9 @@ DefaultStyle Standard
|
||||
PageStyle Headings
|
||||
Provides makeidx 1
|
||||
Provides framed 1
|
||||
# Memoir has support for line spacing, but uses different names from
|
||||
# what setspace.sty does.
|
||||
Provides SetSpace 1
|
||||
|
||||
|
||||
ClassOptions
|
||||
|
@ -642,11 +642,13 @@ string const LaTeXFeatures::getPackages() const
|
||||
}
|
||||
|
||||
// setspace.sty
|
||||
if ((params_.spacing().getSpace() != Spacing::Single
|
||||
&& !params_.spacing().isDefault())
|
||||
|| isRequired("setspace")) {
|
||||
if ((isRequired("setspace")
|
||||
|| ((params_.spacing().getSpace() != Spacing::Single
|
||||
&& !params_.spacing().isDefault())))
|
||||
&& !tclass.provides("SetSpace")) {
|
||||
packages << "\\usepackage{setspace}\n";
|
||||
}
|
||||
bool const upcase = tclass.provides("SetSpace");
|
||||
switch (params_.spacing().getSpace()) {
|
||||
case Spacing::Default:
|
||||
case Spacing::Single:
|
||||
@ -654,13 +656,13 @@ string const LaTeXFeatures::getPackages() const
|
||||
//packages += "\\singlespacing\n";
|
||||
break;
|
||||
case Spacing::Onehalf:
|
||||
packages << "\\onehalfspacing\n";
|
||||
packages << (upcase ? "\\OnehalfSpacing\n" : "\\onehalfspacing\n");
|
||||
break;
|
||||
case Spacing::Double:
|
||||
packages << "\\doublespacing\n";
|
||||
packages << (upcase ? "\\DoubleSpacing\n" : "\\doublespacing\n");
|
||||
break;
|
||||
case Spacing::Other:
|
||||
packages << "\\setstretch{"
|
||||
packages << (upcase ? "\\setSingleSpace{" : "\\setstretch{")
|
||||
<< params_.spacing().getValue() << "}\n";
|
||||
break;
|
||||
}
|
||||
|
@ -89,20 +89,24 @@ void Spacing::writeFile(ostream & os, bool para) const
|
||||
}
|
||||
|
||||
|
||||
string const Spacing::writeEnvirBegin() const
|
||||
string const Spacing::writeEnvirBegin(bool useSetSpace) const
|
||||
{
|
||||
switch (space) {
|
||||
case Default: break; // do nothing
|
||||
case Single:
|
||||
return "\\begin{singlespace}";
|
||||
return (useSetSpace ? "\\begin{SingleSpace}"
|
||||
: "\\begin{singlespace}");
|
||||
case Onehalf:
|
||||
return "\\begin{onehalfspace}";
|
||||
return (useSetSpace ? "\\begin{OnehalfSpace}"
|
||||
: "\\begin{onehalfspace}");
|
||||
case Double:
|
||||
return "\\begin{doublespace}";
|
||||
return (useSetSpace ? "\\begin{DoubleSpace}"
|
||||
: "\\begin{doublespace}");
|
||||
case Other:
|
||||
{
|
||||
ostringstream ost;
|
||||
ost << "\\begin{spacing}{"
|
||||
ost << (useSetSpace ? "\\begin{Spacing}{"
|
||||
: "\\begin{spacing}{" )
|
||||
<< getValueAsString() << '}';
|
||||
return ost.str();
|
||||
}
|
||||
@ -111,18 +115,21 @@ string const Spacing::writeEnvirBegin() const
|
||||
}
|
||||
|
||||
|
||||
string const Spacing::writeEnvirEnd() const
|
||||
string const Spacing::writeEnvirEnd(bool useSetSpace) const
|
||||
{
|
||||
switch (space) {
|
||||
case Default: break; // do nothing
|
||||
case Single:
|
||||
return "\\end{singlespace}";
|
||||
return (useSetSpace ? "\\end{SingleSpace}"
|
||||
: "\\end{singlespace}");
|
||||
case Onehalf:
|
||||
return "\\end{onehalfspace}";
|
||||
return (useSetSpace ? "\\end{OnehalfSpace}"
|
||||
: "\\end{onehalfspace}");
|
||||
case Double:
|
||||
return "\\end{doublespace}";
|
||||
return (useSetSpace ? "\\end{DoubleSpace}"
|
||||
: "\\end{doublespace}");
|
||||
case Other:
|
||||
return "\\end{spacing}";
|
||||
return (useSetSpace ? "\\end{Spacing}" : "\\end{spacing}") ;
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
@ -58,10 +58,12 @@ public:
|
||||
void set(Spacing::Space sp, std::string const & val);
|
||||
///
|
||||
void writeFile(std::ostream &, bool para = false) const;
|
||||
///
|
||||
std::string const writeEnvirBegin() const;
|
||||
///
|
||||
std::string const writeEnvirEnd() const;
|
||||
/// useSetSpace is true when using the variant supported by
|
||||
/// the memoir class.
|
||||
std::string const writeEnvirBegin(bool useSetSpace) const;
|
||||
/// useSetSpace is true when using the variant supported by
|
||||
/// the memoir class.
|
||||
std::string const writeEnvirEnd(bool useSetSpace) const;
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -491,6 +491,7 @@ TeXOnePar(Buffer const & buf,
|
||||
|
||||
// In an inset with unlimited length (all in one row),
|
||||
// don't allow any special options in the paragraph
|
||||
bool const useSetSpace = bparams.getTextClass().provides("SetSpace");
|
||||
if (!pit->forceDefaultParagraphs()) {
|
||||
if (pit->params().startOfAppendix()) {
|
||||
os << "\\appendix\n";
|
||||
@ -501,7 +502,7 @@ TeXOnePar(Buffer const & buf,
|
||||
&& (pit == paragraphs.begin()
|
||||
|| !boost::prior(pit)->hasSameLayout(*pit)))
|
||||
{
|
||||
os << from_ascii(pit->params().spacing().writeEnvirBegin())
|
||||
os << from_ascii(pit->params().spacing().writeEnvirBegin(useSetSpace))
|
||||
<< '\n';
|
||||
texrow.newline();
|
||||
}
|
||||
@ -611,7 +612,7 @@ TeXOnePar(Buffer const & buf,
|
||||
os << '\n';
|
||||
texrow.newline();
|
||||
}
|
||||
os << from_ascii(pit->params().spacing().writeEnvirEnd());
|
||||
os << from_ascii(pit->params().spacing().writeEnvirEnd(useSetSpace));
|
||||
pending_newline = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user