+2002-07-09 Angus Leeming <leeming@lyx.org>
+
+ * lyxpreview2ppm.sh: don't use latex option "-interaction=batchmode"
+ as it's not portable apparently.
2002-07-09 André Pönitz <poenitz@gmx.net>
# \author Angus Leeming, leeming@lyx.org
#
# with much help from David Kastrup, david.kastrup@t-online.de.
-# The sed script was created with advice from Praveen D V <praveend@sasken.com>
-# and the sed users' list sed-users@yahoogroups.com.
+# The sed script was created with advice from Praveen D V, praveend@sasken.com
+# and the sed users' list, sed-users@yahoogroups.com.
# This script takes a LaTeX file and generates PPM files, one per page.
# The idea is to use it with preview.sty to create small bitmap previews of
# Perform the conversion.
cd ${DIR}
-latex -interaction=batchmode ${TEXFILE}
-
+latex ${TEXFILE}
STATUS=$?
EXECUTABLE="latex ${TEXFILE}"; CHECK_STATUS
EXECUTABLE="extracting metrics"; CHECK_STATUS
# The ppm files have spurious (?! say some !) white space on the left and right
-# sides. If you want this set REMOVE_WS=1.
+# sides. If you want this removed set REMOVE_WS=1.
REMOVE_WS=0
which pnmcrop > /dev/null
+2002-07-09 Angus Leeming <leeming@lyx.org>
+
+ * lyxrc.[Ch]: added preview_hashed_labels and preview_scale_factor.
+
2002-07-09 John Levon <moz@compsoc.man.ac.uk>
* lengthcommon.h: whitespace
* LColor.C (LColor): add a corresponding entry to the items array.
- * buffer.C (~Buffer): remove any previewed LaTeX snippets assocoated
+ * buffer.C (~Buffer): remove any previewed LaTeX snippets associated
with this buffer.
2002-07-05 Angus Leeming <leeming@lyx.org>
+2002-07-09 Angus Leeming <leeming@lyx.org>
+
+ * PreviewLoader.C (startLoading): prepend LaTeX file with "\batchmode".
+ Output equation labels as "(#)" if lyxrc preference is set.
+ (setFontScalingFactor): use lyxrc variable preview_scale_factor
+ rather than hard-coding this.
+
2002-07-09 Angus Leeming <leeming@lyx.org>
* PreviewLoader.C: Further refactoring of the code. Should now be
string const latexfile = filename_base + ".tex";
ofstream of(latexfile.c_str());
+ of << "\\batchmode\n";
dumpPreamble(of);
of << "\n\\begin{document}\n";
dumpData(of, inprogress.snippets);
}
}
+ // All equation lables appear as "(#)" + preview.sty's rendering of
+ // the label name
+ if (lyxrc.preview_hashed_labels)
+ os << "\\renewcommand{\\theequation}{\\#}\n";
+
// Use the preview style file to ensure that each snippet appears on a
// fresh page.
os << "\n"
double setFontScalingFactor(Buffer & buffer)
{
- static double const lyxrc_preview_scale_factor = 0.9;
double scale_factor = 0.01 * lyxrc.dpi * lyxrc.zoom *
- lyxrc_preview_scale_factor;
+ lyxrc.preview_scale_factor;
// Has the font size been set explicitly?
string const & fontsize = buffer.params.fontsize;
if (!prefixIs(frontStrip(str), "\\ExecuteOptions"))
continue;
- str = split(str, '{');
+ // str contains just the options of \ExecuteOptions
+ string const tmp = split(str, '{');
+ split(tmp, str, '}');
+
int count = 0;
string tok = token(str, ',', count++);
while (!isValidLength(tok) && !tok.empty())
#include <map>
-
namespace grfx {
bool Previews::activated()
{ "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
{ "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
{ "\\preview", LyXRC::RC_PREVIEW },
+ { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
+ { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
{ "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
{ "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
{ "\\print_command", LyXRC::RC_PRINT_COMMAND },
dialogs_iconify_with_main = false;
label_init_length = 3;
preview = false;
+ preview_hashed_labels = false;
+ preview_scale_factor = 0.9;
/// These variables are not stored on disk (perhaps they
// should be moved from the LyXRC class).
preview = lexrc.getBool();
break;
+ case RC_PREVIEW_HASHED_LABELS:
+ if (lexrc.next())
+ preview_hashed_labels = lexrc.getBool();
+ break;
+
+ case RC_PREVIEW_SCALE_FACTOR:
+ if (lexrc.next())
+ preview_hashed_labels = lexrc.getInteger();
+ break;
+
case RC_LAST: break; // this is just a dummy
}
}
os << "\\preview " << tostr(preview) << "\n";
}
+ case RC_PREVIEW_HASHED_LABELS:
+ if (preview_hashed_labels !=
+ system_lyxrc.preview_hashed_labels) {
+ os << "\\preview_hashed_labels "
+ << tostr(preview_hashed_labels) << "\n";
+ }
+
+ case RC_PREVIEW_SCALE_FACTOR:
+ if (preview_scale_factor != system_lyxrc.preview_scale_factor) {
+ os << "\\preview_scale_factor "
+ << preview_scale_factor << "\n";
+ }
+
os << "\n#\n"
<< "# SCREEN & FONTS SECTION ############################\n"
<< "#\n\n";
break;
case RC_PREVIEW:
- str = _("Shows a typeset preview besides formulas");
+ str = _("Shows a typeset preview of things such as math");
+ break;
+
+ case RC_PREVIEW_HASHED_LABELS:
+ str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
+ break;
+
+ case RC_PREVIEW_SCALE_FACTOR:
+ str = _("Scale the preview size to suit.");
break;
default:
RC_LABEL_INIT_LENGTH,
RC_DISPLAY_GRAPHICS,
RC_PREVIEW,
+ RC_PREVIEW_HASHED_LABELS,
+ RC_PREVIEW_SCALE_FACTOR,
#ifdef USE_PSPELL
RC_USE_PSPELL,
#endif
bool show_banner;
///
bool preview;
+ ///
+ bool preview_hashed_labels;
+ ///
+ int preview_scale_factor;
+
private:
/// Is a bind file already (or currently) read?
bool hasBindFile;
2002-07-05 Angus Leeming <leeming@lyx.org>
* formula.[Ch] (generatePreview): instantiate new virtual method.
- Strip out the preliminary preview code and replace with new that
+ Strip out the preliminary preview code and replace with code that
makes full use of the graphics/Preview* files. Hide all the shenanigans
behind a PreviewImpl firewall.