else:
return
+
def revert_diagram(document):
" Add the feyn package if \\Diagram is used in math "
i = 0
return
+def convert_bibtexClearpage(document):
+ " insert a clear(double)page bibliographystyle if bibtotoc option is used "
+ while True:
+ i = find_token(document.header, '\\papersides', 0)
+ document.warning(str(i))
+ if i == -1:
+ document.warning("Malformed LyX document: Can't find papersides definition.")
+ return
+ else:
+ sides = int(document.header[i][12])
+ # only act of there is the option "bibtotoc"
+ j = find_token(document.body, 'options "bibtotoc', 0)
+ if j == -1:
+ return
+ subst1 = '\\begin_layout Standard\n' \
+ + '\\begin_inset Newpage clearpage\n' \
+ + '\end_inset\n\n\n' \
+ + '\end_layout\n'
+ subst2 = '\\begin_layout Standard\n' \
+ + '\\begin_inset Newpage cleardoublepage\n' \
+ + '\end_inset\n\n\n' \
+ + '\end_layout\n'
+ if sides == 1:
+ document.body.insert(j -5, subst1)
+ else:
+ document.body.insert(j -5, subst2)
+ return
+
##
# Conversion hub
[398, []],
[399, [convert_mathdots]],
[400, [convert_rule]],
- [401, []]
+ [401, []],
+ [402, [convert_bibtexClearpage]]
]
-revert = [[400, [revert_diagram]],
+revert = [[401, []],
+ [400, [revert_diagram]],
[399, [revert_rule]],
[398, [revert_mathdots]],
[397, [revert_mathrsfs]],
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
-int const LYX_FORMAT = 401; // Ronen: support for \Diagram
+int const LYX_FORMAT = 402; // uwestoehr: fix for bug 1881
typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
#include "LaTeXFeatures.h"
#include "output_xhtml.h"
#include "OutputParams.h"
+#include "PDFOptions.h"
#include "TextClass.h"
#include "frontends/alert.h"
// bibtotoc-Option
if (!bibtotoc.empty() && !buffer().params().use_bibtopic) {
- if (buffer().params().documentClass().hasLaTeXLayout("chapter")) {
- if (buffer().params().sides == OneSide) {
- // oneside
- os << "\\clearpage";
- } else {
- // twoside
- os << "\\cleardoublepage";
- }
+ // set label for hyperref, see http://www.lyx.org/trac/ticket/6470
+ if (buffer().params().pdfoptions().use_hyperref)
+ os << "\\phantomsection";
+ if (buffer().params().documentClass().hasLaTeXLayout("chapter"))
os << "\\addcontentsline{toc}{chapter}{\\bibname}";
- } else if (buffer().params().documentClass().hasLaTeXLayout("section"))
+ else if (buffer().params().documentClass().hasLaTeXLayout("section"))
os << "\\addcontentsline{toc}{section}{\\refname}";
}