mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 18:52:46 +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
|
PageStyle Headings
|
||||||
Provides makeidx 1
|
Provides makeidx 1
|
||||||
Provides framed 1
|
Provides framed 1
|
||||||
|
# Memoir has support for line spacing, but uses different names from
|
||||||
|
# what setspace.sty does.
|
||||||
|
Provides SetSpace 1
|
||||||
|
|
||||||
|
|
||||||
ClassOptions
|
ClassOptions
|
||||||
|
@ -642,11 +642,13 @@ string const LaTeXFeatures::getPackages() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setspace.sty
|
// setspace.sty
|
||||||
if ((params_.spacing().getSpace() != Spacing::Single
|
if ((isRequired("setspace")
|
||||||
&& !params_.spacing().isDefault())
|
|| ((params_.spacing().getSpace() != Spacing::Single
|
||||||
|| isRequired("setspace")) {
|
&& !params_.spacing().isDefault())))
|
||||||
|
&& !tclass.provides("SetSpace")) {
|
||||||
packages << "\\usepackage{setspace}\n";
|
packages << "\\usepackage{setspace}\n";
|
||||||
}
|
}
|
||||||
|
bool const upcase = tclass.provides("SetSpace");
|
||||||
switch (params_.spacing().getSpace()) {
|
switch (params_.spacing().getSpace()) {
|
||||||
case Spacing::Default:
|
case Spacing::Default:
|
||||||
case Spacing::Single:
|
case Spacing::Single:
|
||||||
@ -654,13 +656,13 @@ string const LaTeXFeatures::getPackages() const
|
|||||||
//packages += "\\singlespacing\n";
|
//packages += "\\singlespacing\n";
|
||||||
break;
|
break;
|
||||||
case Spacing::Onehalf:
|
case Spacing::Onehalf:
|
||||||
packages << "\\onehalfspacing\n";
|
packages << (upcase ? "\\OnehalfSpacing\n" : "\\onehalfspacing\n");
|
||||||
break;
|
break;
|
||||||
case Spacing::Double:
|
case Spacing::Double:
|
||||||
packages << "\\doublespacing\n";
|
packages << (upcase ? "\\DoubleSpacing\n" : "\\doublespacing\n");
|
||||||
break;
|
break;
|
||||||
case Spacing::Other:
|
case Spacing::Other:
|
||||||
packages << "\\setstretch{"
|
packages << (upcase ? "\\setSingleSpace{" : "\\setstretch{")
|
||||||
<< params_.spacing().getValue() << "}\n";
|
<< params_.spacing().getValue() << "}\n";
|
||||||
break;
|
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) {
|
switch (space) {
|
||||||
case Default: break; // do nothing
|
case Default: break; // do nothing
|
||||||
case Single:
|
case Single:
|
||||||
return "\\begin{singlespace}";
|
return (useSetSpace ? "\\begin{SingleSpace}"
|
||||||
|
: "\\begin{singlespace}");
|
||||||
case Onehalf:
|
case Onehalf:
|
||||||
return "\\begin{onehalfspace}";
|
return (useSetSpace ? "\\begin{OnehalfSpace}"
|
||||||
|
: "\\begin{onehalfspace}");
|
||||||
case Double:
|
case Double:
|
||||||
return "\\begin{doublespace}";
|
return (useSetSpace ? "\\begin{DoubleSpace}"
|
||||||
|
: "\\begin{doublespace}");
|
||||||
case Other:
|
case Other:
|
||||||
{
|
{
|
||||||
ostringstream ost;
|
ostringstream ost;
|
||||||
ost << "\\begin{spacing}{"
|
ost << (useSetSpace ? "\\begin{Spacing}{"
|
||||||
|
: "\\begin{spacing}{" )
|
||||||
<< getValueAsString() << '}';
|
<< getValueAsString() << '}';
|
||||||
return ost.str();
|
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) {
|
switch (space) {
|
||||||
case Default: break; // do nothing
|
case Default: break; // do nothing
|
||||||
case Single:
|
case Single:
|
||||||
return "\\end{singlespace}";
|
return (useSetSpace ? "\\end{SingleSpace}"
|
||||||
|
: "\\end{singlespace}");
|
||||||
case Onehalf:
|
case Onehalf:
|
||||||
return "\\end{onehalfspace}";
|
return (useSetSpace ? "\\end{OnehalfSpace}"
|
||||||
|
: "\\end{onehalfspace}");
|
||||||
case Double:
|
case Double:
|
||||||
return "\\end{doublespace}";
|
return (useSetSpace ? "\\end{DoubleSpace}"
|
||||||
|
: "\\end{doublespace}");
|
||||||
case Other:
|
case Other:
|
||||||
return "\\end{spacing}";
|
return (useSetSpace ? "\\end{Spacing}" : "\\end{spacing}") ;
|
||||||
}
|
}
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
@ -58,10 +58,12 @@ public:
|
|||||||
void set(Spacing::Space sp, std::string const & val);
|
void set(Spacing::Space sp, std::string const & val);
|
||||||
///
|
///
|
||||||
void writeFile(std::ostream &, bool para = false) const;
|
void writeFile(std::ostream &, bool para = false) const;
|
||||||
///
|
/// useSetSpace is true when using the variant supported by
|
||||||
std::string const writeEnvirBegin() const;
|
/// the memoir class.
|
||||||
///
|
std::string const writeEnvirBegin(bool useSetSpace) const;
|
||||||
std::string const writeEnvirEnd() const;
|
/// useSetSpace is true when using the variant supported by
|
||||||
|
/// the memoir class.
|
||||||
|
std::string const writeEnvirEnd(bool useSetSpace) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
|
@ -491,6 +491,7 @@ TeXOnePar(Buffer const & buf,
|
|||||||
|
|
||||||
// In an inset with unlimited length (all in one row),
|
// In an inset with unlimited length (all in one row),
|
||||||
// don't allow any special options in the paragraph
|
// don't allow any special options in the paragraph
|
||||||
|
bool const useSetSpace = bparams.getTextClass().provides("SetSpace");
|
||||||
if (!pit->forceDefaultParagraphs()) {
|
if (!pit->forceDefaultParagraphs()) {
|
||||||
if (pit->params().startOfAppendix()) {
|
if (pit->params().startOfAppendix()) {
|
||||||
os << "\\appendix\n";
|
os << "\\appendix\n";
|
||||||
@ -501,7 +502,7 @@ TeXOnePar(Buffer const & buf,
|
|||||||
&& (pit == paragraphs.begin()
|
&& (pit == paragraphs.begin()
|
||||||
|| !boost::prior(pit)->hasSameLayout(*pit)))
|
|| !boost::prior(pit)->hasSameLayout(*pit)))
|
||||||
{
|
{
|
||||||
os << from_ascii(pit->params().spacing().writeEnvirBegin())
|
os << from_ascii(pit->params().spacing().writeEnvirBegin(useSetSpace))
|
||||||
<< '\n';
|
<< '\n';
|
||||||
texrow.newline();
|
texrow.newline();
|
||||||
}
|
}
|
||||||
@ -611,7 +612,7 @@ TeXOnePar(Buffer const & buf,
|
|||||||
os << '\n';
|
os << '\n';
|
||||||
texrow.newline();
|
texrow.newline();
|
||||||
}
|
}
|
||||||
os << from_ascii(pit->params().spacing().writeEnvirEnd());
|
os << from_ascii(pit->params().spacing().writeEnvirEnd(useSetSpace));
|
||||||
pending_newline = true;
|
pending_newline = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user