// Have to overwrite the default InsetCommand method in order to check that // the \cite command is valid. Eg, the user has natbib enabled, inputs some // citations and then changes his mind, turning natbib support off. The output // should revert to the default citation command as provided by the citation // engine, e.g. \cite[]{} for the basic engine. void InsetCitation::latex(otexstream & os, OutputParams const & runparams) const { vector<CitationStyle> citation_styles = buffer().params().citeStyles(); CitationStyle cs = asValidLatexCommand(getCmdName(), citation_styles); BiblioInfo const & bi = buffer().masterBibInfo(); // FIXME UNICODE docstring const cite_str = from_utf8(citationStyleToString(cs)); if (runparams.inulemcmd > 0) os << "\\mbox{"; os << "\\" << cite_str; docstring const & before = getParam("before"); docstring const & after = getParam("after"); if (!before.empty() && cs.textBefore) os << '[' << before << "][" << after << ']'; else if (!after.empty() && cs.textAfter) os << '[' << after << ']'; if (!bi.isBibtex(getParam("key"))) // escape chars with bibitems os << '{' << escape(cleanupWhitespace(getParam("key"))) << '}'; else os << '{' << cleanupWhitespace(getParam("key")) << '}'; if (runparams.inulemcmd) os << "}"; }
// Have to overwrite the default InsetCommand method in order to check that // the \cite command is valid. Eg, the user has natbib enabled, inputs some // citations and then changes his mind, turning natbib support off. The output // should revert to \cite[]{} void InsetCitation::latex(otexstream & os, OutputParams const & runparams) const { CiteEngine cite_engine = buffer().params().citeEngine(); BiblioInfo const & bi = buffer().masterBibInfo(); // FIXME UNICODE docstring const cite_str = from_utf8( asValidLatexCommand(getCmdName(), cite_engine)); if (runparams.inulemcmd) os << "\\mbox{"; os << "\\" << cite_str; docstring const & before = getParam("before"); docstring const & after = getParam("after"); if (!before.empty() && cite_engine != ENGINE_BASIC) os << '[' << before << "][" << after << ']'; else if (!after.empty()) os << '[' << after << ']'; if (!bi.isBibtex(getParam("key"))) // escape chars with bibitems os << '{' << escape(cleanupWhitespace(getParam("key"))) << '}'; else os << '{' << cleanupWhitespace(getParam("key")) << '}'; if (runparams.inulemcmd) os << "}"; }
int InsetCitation::docbook(odocstream & os, OutputParams const &) const { os << from_ascii("<citation>") << cleanupWhitespace(getParam("key")) << from_ascii("</citation>"); return 0; }