是的我有个问题。因此,我有一个脚本,它将所有脚注放在文档的末尾,并从文本中的小数字到合适的尾注进行交叉引用。现在我想添加一个反向链接,这样当我有一个很长的文档(书)时,我不需要用手向后滚动,只需点击尾注就可以返回。
到目前为止,我已经设法获得了作为crossref源的尾注,但我正在努力处理crossref目标
当我使用footnote.storyOffset作为目的地时,它搞乱了文本中脚注的编号。例如,第一个脚注从文本中消失,然后是1,3,3,4,5,7……诸若此类。这一切为什么要发生??我只是使用这个插入点作为目的地,突然它把一切都搞砸了。
手动将脚注数字放入文本中也是足够的,但我不知道如何删除文本中混乱的数字。我也可以使用下一个或前一个字符作为insertionPoint,但如何实现呢?
我是indesign脚本的新手。希望有人能帮我。
以下是源代码的关键部分:
stories[j].insertionPoints[-1].contents = SpecialCharacters.PAGE_BREAK; // add new page for notes
stories[j].insertionPoints[-1].contents = 'Notes';// title
footn = stories[j].footnotes;
for (var i = 0; i < footn.length; i++)
{
stories[j].insertionPoints[-1].contents = '\r';
endnote = footn[i].texts[0].move (LocationOptions.after, stories[j].insertionPoints[-1]);
endnote.applyParagraphStyle (note_styles.first, false);
if (i === 0)
{
endnote.numberingContinue = false;
endnote.numberingStartAt = 1;
}
if (endnote.paragraphs.length > 1)
{
endnote.paragraphs.itemByRange (1,-1).applyParagraphStyle (note_styles.next, false);
}
//var stoff = footn[i].storyOffset;
//stoff.contents = ''+(i+1);
//stoff.applyCharacterStyle(note_styles.char_style_in_text);
//stoff.appliedCharacterStyle.position= Position.superscript;
backlink_destination = doc.paragraphDestinations.add (footn[i].storyOffset); // position of footnote in text
endnote_destination = doc.paragraphDestinations.add (endnote.insertionPoints[0]);
try
{
crb = app.activeDocument.crossReferenceFormats.add({name:'backlink'+i});
crb.appliedCharacterStyle = note_styles.char_style_endnote;
crb.buildingBlocks.add (BuildingBlockTypes.customStringBuildingBlock);
crb.buildingBlocks.anyItem().customText = endnote.contents;
}
catch(_)
{
crb = app.activeDocument.crossReferenceFormats.item ('backlink'+i);
};
backlink_source = doc.crossReferenceSources.add (endnote, crb); // position of note at end of story
endnote_source = doc.crossReferenceSources.add (footn[i].storyOffset, note_styles.cr_format);
doc.hyperlinks.add(backlink_source, backlink_destination, {visible: false}); //add link from notes to text
doc.hyperlinks.add(endnote_source, endnote_destination, {visible: false});
} // for发布于 2013-07-27 04:12:52
修复:
我只是颠倒了制作交叉参照的顺序。
我跳过了下面的几行
backlink_destination = doc.paragraphDestinations.add (footn[i].storyOffset);
endnote_destination = doc.paragraphDestinations.add (endnote.insertionPoints[0]);至
endnote_destination = doc.paragraphDestinations.add (endnote.insertionPoints[0]);
backlink_destination = doc.paragraphDestinations.add (footn[i].storyOffset);和
backlink_source = doc.crossReferenceSources.add (endnote, crb);
endnote_source = doc.crossReferenceSources.add (footn[i].storyOffset, note_styles.cr_format);至
endnote_source = doc.crossReferenceSources.add (footn[i].storyOffset, note_styles.cr_format);
backlink_source = doc.crossReferenceSources.add (endnote, crb);和
doc.hyperlinks.add(backlink_source, backlink_destination, {visible: false});
doc.hyperlinks.add(endnote_source, endnote_destination, {visible: false});至
doc.hyperlinks.add(endnote_source, endnote_destination, {visible: false});
doc.hyperlinks.add(backlink_source, backlink_destination, {visible: false});我不知道为什么,但它工作时,放在这个顺序…这并不能证明好的软件...
我怎么能期望这么高的价格能有好的软件呢?
https://stackoverflow.com/questions/17867397
复制相似问题