summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hvextern/doc/hvextern.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-05-01 03:03:29 +0000
committerNorbert Preining <norbert@preining.info>2022-05-01 03:03:29 +0000
commitbd031e64d0627026284118a2a8ceaf112f7e04e9 (patch)
tree394fb6ad63b72abdc59a846724e223825a2e4e9b /macros/latex/contrib/hvextern/doc/hvextern.tex
parent9f2f967e007f0ea011b3875148304d46c921dd90 (diff)
CTAN sync 202205010303
Diffstat (limited to 'macros/latex/contrib/hvextern/doc/hvextern.tex')
-rw-r--r--macros/latex/contrib/hvextern/doc/hvextern.tex91
1 files changed, 82 insertions, 9 deletions
diff --git a/macros/latex/contrib/hvextern/doc/hvextern.tex b/macros/latex/contrib/hvextern/doc/hvextern.tex
index 50d93cef06..0ad4419627 100644
--- a/macros/latex/contrib/hvextern/doc/hvextern.tex
+++ b/macros/latex/contrib/hvextern/doc/hvextern.tex
@@ -30,7 +30,7 @@ from within a main \LaTeX\ document~--v. \hvexternFileversion}
\end{verbatim}
\begin{sloppypar}
-This package allows to write external \MP, \TeX, \ConTeXt, \LaTeX, \LuaTeX, \LuaLaTeX, \XeTeX, \XeLaTeX, Lua, Perl and/or Python
+This package allows to write external \MP, \TeX, \ConTeXt, \LaTeX, \LuaTeX, \LuaLaTeX, \XeTeX, \XeLaTeX, Lua, Perl, Java and/or Python
source code, which will then be run via \texttt{shell escape} to create a PDF oder text output to include
it into the main \LaTeX\ document.
\end{sloppypar}
@@ -82,7 +82,7 @@ shown by the environment \texttt{externalDocument}.
\begin{minipage}{.59\linewidth}
\begin{lstlisting}
\begin{externalDocument}[
- compiler=pdflatex,force,cleanup]{Roemer1}
+ compiler=pdflatex,force,cleanup]{voss}
\documentclass{standalone}
%StartVisiblePreamble
\usepackage{fontenc}
@@ -106,7 +106,7 @@ shown by the environment \texttt{externalDocument}.
\end{minipage}
\begin{minipage}{.39\linewidth}
\begin{externalDocument}[
- compiler=pdflatex,force,cleanup={log,aux},verbose]{Roemer1}
+ compiler=pdflatex,force,cleanup={log,aux},verbose]{voss}
\documentclass{standalone}
%StartVisiblePreamble
\usepackage{fontenc}
@@ -261,11 +261,9 @@ image.save(imageName+".png", "PNG")
-
-
\begin{externalDocument}[grfOptions={width=0.95\linewidth},
compiler=xelatex,code,mpwidth=0.6\linewidth,
- crop,cleanup,force,usefancyvrb=false,ext=tex]{Senger3}
+ crop,cleanup,force,usefancyvrb=false,ext=tex]{voss}
\documentclass{article}
%StartVisiblePreamble
\usepackage{tikz}
@@ -400,6 +398,80 @@ Sort with xindex \verb|-l DE --config AU|
\end{externalDocument}
+The following Java-program creates the Mandelbrot set as png image. The valid setting for
+the environment \texttt{externalDocument} is:
+
+\begin{verbatim}
+ compiler=java,ext=java,docType=java,
+\end{verbatim}
+
+\begin{externalDocument}[
+ verbose,
+ compiler=java,ext=java,code,
+ force,docType=java,includegraphic,
+ usefancyvrb,grfOptions={width=0.9\linewidth}]{java}
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.awt.image.RenderedImage;
+import java.io.File;
+import javax.imageio.ImageIO;
+
+public class Main {
+
+//StartVisiblePreamble
+ public static int iterZahl(final double cx, final double cy, int maxIt,
+ final double radius) {
+ // bestimmt Anzahl der Iterationen
+ int zaehler = 0;
+ double zx = 0.0, zy = 0.0, tmp;
+ do {
+ tmp = zx*zx - zy*zy + cx;
+ zy = 2*zx*zy + cy; zx = tmp;
+ zaehler++;
+ } while (zx*zx + zy*zy <= radius && zaehler < maxIt);
+ return zaehler;
+ }
+//StopVisiblePreamble
+ public static void main(String[] argv) throws Exception {
+ String f_name = new File ((Main.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getPath()).getName();
+ String basename = f_name.replaceAll("\\.[^.]*$", "");
+ int imageBreite = 540, imageHoehe = 405;
+ BufferedImage bufferedImage = new BufferedImage(imageBreite, imageHoehe, BufferedImage.TYPE_INT_RGB);
+ Graphics g = bufferedImage.createGraphics();
+//StartVisibleMain
+ double xa = -2.5, xe = 0.7, ya = -1.2, ye = 1.2; // Ratio 20:15
+ double dx = (xe-xa)/(imageBreite-1), dy = (ye-ya)/(imageHoehe-1);
+ double cx, cy; int R, G, B;
+ double radius = 10.0; int maxIt = 1024;
+ cx = xa;
+ for (int sp = 0; sp < imageBreite; sp++) {
+ cy = ye; // von oben nach unten
+ for (int ze = 0; ze < imageHoehe; ze++) {
+ int zIter = iterZahl(cx, cy, maxIt, radius);
+ if (zIter == maxIt) {
+ g.setColor(Color.WHITE);
+ g.drawLine(sp, ze, sp, ze);
+ } else {
+ R = zIter % 4 * 6 ; G = zIter % 8 * 32; B = zIter % 16 * 16;
+ g.setColor(new Color(R,G,B));
+ g.drawLine(sp, ze, sp, ze);
+ }
+ cy = cy - dy;
+ } // for ze
+ cx = cx + dx;
+ } // for sp
+//StopVisibleMain
+ g.dispose();
+ RenderedImage rendImage = bufferedImage;
+
+ File file = new File(basename+".png");
+ ImageIO.write(rendImage, "png", file);
+ }
+}
+\end{externalDocument}
+
+
@@ -413,7 +485,7 @@ the follwing example.
\begin{externalDocument}[grfOptions={angle=90,width=\linewidth},
compiler=xelatex,code,mpwidth=0.6\linewidth,
- crop,cleanup,force]{Senger3}
+ crop,cleanup,force]{voss}
\documentclass{article}
%StartVisiblePreamble
\usepackage{tikz}
@@ -1305,6 +1377,7 @@ it makes no difference using the optional argument \texttt{usefancyvrb} or not.
showFilename,
% crop,
force,
+ cleanup,
code,
docType=mp,
ext=mp,]{voss}
@@ -1394,7 +1467,7 @@ This is the start of the introduction.
\begin{externalDocument}[
grfOptions={width=0.5\linewidth},
% pages={1,3},
- frame,
+% frame,
verbose=false,
compiler=lualatex,
showFilename,
@@ -1414,7 +1487,7 @@ This is the start of the introduction.
\begin{pspicture}(-9,-15)(9,2)
\psaxes(0,0)(-9,-15)(9,2)
\psplot[algebraic,plotstyle=curve,curvature=1 1 0,
- linewidth=1pt,linecolor=red]{-8}{8}{
+ linewidth=2pt,linecolor=red]{-8}{8}{
1 - 3876218985722260225*x^2/10892114744073986176
+ 14975974793271450625*x^4/174273835905183778816
- 317095420958296875*x^6/26811359370028273664