]> git.lyx.org Git - features.git/commitdiff
Add formats and converters for cropped PDF/EPS
authorVincent van Ravesteijn <vfr@lyx.org>
Thu, 23 May 2013 13:04:12 +0000 (15:04 +0200)
committerVincent van Ravesteijn <vfr@lyx.org>
Mon, 27 May 2013 20:06:33 +0000 (22:06 +0200)
With LyX configured in this way, the user would only need to:

File > New from Template > EPS.lyx (or PDF-cropped.lyx):
- insert a math inset and type in an equation, or create whatever
  content LaTeX can handle,
- view/export to cropped EPS/PDF.

This would allow for LyX to act as a "generator for includable graphics" (equations, commented graphics, etc).

This fixes bug #7839.

lib/configure.py
lib/templates/EPS-cropped.lyx [new file with mode: 0644]
lib/templates/PDF-cropped.lyx [new file with mode: 0644]

index f2197131110e0f64e138a15ac98eed281cdd9570..f71ca02a01162c84cc4079c63f231aeaaefef218 100644 (file)
@@ -581,6 +581,7 @@ def checkFormatEntries(dtl_tools):
     checkViewer('a Postscript previewer', ['kghostview', 'okular', 'evince', 'gv', 'ghostview -swap'],
         rc_entry = [r'''\Format eps        eps     EPS                    "" "%%"      ""      "vector"        "image/x-eps"
 \Format eps2       eps    "EPS (uncropped)"       "" "%%"      ""      "vector"        ""
+\Format eps3       eps    "EPS (cropped)"         "" "%%"      ""      "document,menu=export"  ""
 \Format ps         ps      Postscript             t  "%%"      ""      "document,vector,menu=export"   "application/postscript"'''])
     # for xdg-open issues look here: http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg151818.html
     # the MIME type is set for pdf6, because that one needs to be autodetectable by libmime
@@ -591,7 +592,8 @@ def checkFormatEntries(dtl_tools):
 \Format pdf3       pdf    "PDF (dvipdfm)"         m  "%%"      ""      "document,vector,menu=export"   ""
 \Format pdf4       pdf    "PDF (XeTeX)"           X  "%%"      ""      "document,vector,menu=export"   ""
 \Format pdf5       pdf    "PDF (LuaTeX)"          u  "%%"      ""      "document,vector,menu=export"   ""
-\Format pdf6       pdf    "PDF (graphics)"        "" "%%"      ""      "vector"        "application/pdf"'''])
+\Format pdf6       pdf    "PDF (graphics)"        "" "%%"      ""      "vector"        "application/pdf"
+\Format pdf7       pdf    "PDF (cropped)"         "" "%%"      ""      "document,menu=export"  ""'''])
     #
     checkViewer('a DVI previewer', ['xdvi', 'kdvi', 'okular', 'yap', 'dviout -Set=!m'],
         rc_entry = [r'''\Format dvi        dvi     DVI                    D  "%%"      ""      "document,vector,menu=export"   "application/x-dvi"
@@ -789,6 +791,9 @@ def checkConverterEntries():
     checkProg('a PDF to EPS converter', ['pdftops -eps -f 1 -l 1 $$i $$o'],
         rc_entry = [ r'\converter pdf6        eps        "%%"  ""' ])
     #
+    checkProg('a PDF cropping tool', ['pdfcrop $$i $$o'],
+        rc_entry = [ r'\converter pdf2   pdf7       "%%"       ""' ])
+    #
     checkProg('a Beamer info extractor', ['makebeamerinfo -p $$i'],
         rc_entry = [ r'\converter pdf2         beamer.info        "%%" ""' ])
     #
@@ -798,6 +803,9 @@ def checkConverterEntries():
     checkProg('a DVI to PS converter', ['dvips -o $$o $$i'],
         rc_entry = [ r'\converter dvi        ps         "%%"   ""' ])
     #
+    checkProg('a DVI to cropped EPS converter', ['dvips -E -o $$o $$i'],
+        rc_entry = [ r'\converter dvi        eps3         "%%" ""' ])
+    #
     checkProg('a DVI to PDF converter', ['dvipdfmx -o $$o $$i', 'dvipdfm -o $$o $$i'],
         rc_entry = [ r'\converter dvi        pdf3       "%%"   ""' ])
     #
diff --git a/lib/templates/EPS-cropped.lyx b/lib/templates/EPS-cropped.lyx
new file mode 100644 (file)
index 0000000..6ccd58f
--- /dev/null
@@ -0,0 +1,108 @@
+#LyX 2.1 created this file. For more info see http://www.lyx.org/
+\lyxformat 469
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_math auto
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+\graphics default
+\default_output_format eps3
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\spacing single
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_package amsmath 1
+\use_package amssymb 1
+\use_package cancel 1
+\use_package esint 1
+\use_package mathdots 1
+\use_package mathtools 1
+\use_package mhchem 1
+\use_package stackrel 1
+\use_package stmaryrd 1
+\use_package undertilde 1
+\cite_engine basic
+\cite_engine_type numerical
+\biblio_style plain
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\justification true
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle empty
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Standard
+\begin_inset Note Note
+status open
+
+\begin_layout Paragraph*
+LyX Equation Editor 
+\end_layout
+
+\begin_layout Plain Layout
+Use this template to generate 
+\begin_inset Quotes eld
+\end_inset
+
+embeddable graphics
+\begin_inset Quotes erd
+\end_inset
+
+ (equations, commented graphics, etc.).
+ Simply write down some content (say, '
+\begin_inset Formula $x^{2}-\gamma$
+\end_inset
+
+) and hit the Preview button: you will obtain a cropped EPS output of the
+ LyX content.
+ Now you can insert the resulting vector EPS image into a different document
+ (another LyX document, a LibreOffice Presentation, a Beamer presentation,
+ etc.).
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/lib/templates/PDF-cropped.lyx b/lib/templates/PDF-cropped.lyx
new file mode 100644 (file)
index 0000000..9e39ad1
--- /dev/null
@@ -0,0 +1,108 @@
+#LyX 2.1 created this file. For more info see http://www.lyx.org/
+\lyxformat 469
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_math auto
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+\graphics default
+\default_output_format pdf7
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\spacing single
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_package amsmath 1
+\use_package amssymb 1
+\use_package cancel 1
+\use_package esint 1
+\use_package mathdots 1
+\use_package mathtools 1
+\use_package mhchem 1
+\use_package stackrel 1
+\use_package stmaryrd 1
+\use_package undertilde 1
+\cite_engine basic
+\cite_engine_type numerical
+\biblio_style plain
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\justification true
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle empty
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Standard
+\begin_inset Note Note
+status open
+
+\begin_layout Paragraph*
+LyX Equation Editor 
+\end_layout
+
+\begin_layout Plain Layout
+Use this template to generate 
+\begin_inset Quotes eld
+\end_inset
+
+embeddable graphics
+\begin_inset Quotes erd
+\end_inset
+
+ (equations, commented graphics, etc.).
+ Simply write down some content (say, '
+\begin_inset Formula $x^{2}-\gamma$
+\end_inset
+
+) and hit the Preview button: you will obtain a cropped PDF output of the
+ LyX content.
+ Now you can insert the resulting vector PDF image into a different document
+ (another LyX document, a LibreOffice Presentation, a Beamer presentation,
+ etc.).
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document