diff options
Diffstat (limited to 'graphics/metapost/contrib/macros/wordcloud')
-rw-r--r-- | graphics/metapost/contrib/macros/wordcloud/README.md | 6 | ||||
-rw-r--r-- | graphics/metapost/contrib/macros/wordcloud/doc/wordcloud-doc-en.pdf | bin | 118155 -> 119440 bytes | |||
-rw-r--r-- | graphics/metapost/contrib/macros/wordcloud/doc/wordcloud-doc-en.tex | 31 | ||||
-rw-r--r-- | graphics/metapost/contrib/macros/wordcloud/metapost/wordcloud.mp | 2 | ||||
-rw-r--r-- | graphics/metapost/contrib/macros/wordcloud/scripts/wordcloud.lua | 4 | ||||
-rw-r--r-- | graphics/metapost/contrib/macros/wordcloud/tex/wordcloud.sty | 14 |
6 files changed, 33 insertions, 24 deletions
diff --git a/graphics/metapost/contrib/macros/wordcloud/README.md b/graphics/metapost/contrib/macros/wordcloud/README.md index a4db68ebf4..2fb8d968f4 100644 --- a/graphics/metapost/contrib/macros/wordcloud/README.md +++ b/graphics/metapost/contrib/macros/wordcloud/README.md @@ -13,7 +13,7 @@ repository on github: ## Installation -MPchess is on the [ctan](ctan.org) and can be installed via the package manager of your +Wordcloud is on the [ctan](ctan.org) and can be installed via the package manager of your distribution [https://www.ctan.org/pkg/wordcloud](https://www.ctan.org/pkg/wordcloud). ### With TeX live under Linux or MacOS @@ -34,7 +34,7 @@ Then, you will have to place the .mp files in the ### With MikTEX and Windows -These two systems are unknown to the author of MPchess, so we refer to their +These two systems are unknown to the author of Wordcloud, so we refer to their documentation to add local packages: [http://docs.miktex.org/manual/localadditions.html](http://docs.miktex.org/manual/localadditions.html) @@ -54,4 +54,4 @@ Maxime Chupin, `notezik(at)gmail.com` ## Licenses -This projet is under LATEX Project Public License 1.3c.
\ No newline at end of file +This projet is under LATEX Project Public License 1.3c. diff --git a/graphics/metapost/contrib/macros/wordcloud/doc/wordcloud-doc-en.pdf b/graphics/metapost/contrib/macros/wordcloud/doc/wordcloud-doc-en.pdf Binary files differindex 38656d0d9b..8491dd2191 100644 --- a/graphics/metapost/contrib/macros/wordcloud/doc/wordcloud-doc-en.pdf +++ b/graphics/metapost/contrib/macros/wordcloud/doc/wordcloud-doc-en.pdf diff --git a/graphics/metapost/contrib/macros/wordcloud/doc/wordcloud-doc-en.tex b/graphics/metapost/contrib/macros/wordcloud/doc/wordcloud-doc-en.tex index e3ef5b24ae..00b3b0ddbf 100644 --- a/graphics/metapost/contrib/macros/wordcloud/doc/wordcloud-doc-en.tex +++ b/graphics/metapost/contrib/macros/wordcloud/doc/wordcloud-doc-en.tex @@ -6,9 +6,6 @@ % Originally written by Maxime Chupin <notezik@gmail.com>, % 2023. % -% Distributed under the terms of the GNU free documentation licence: -% http://www.gnu.org/licenses/fdl.html -% without any invariant section or cover text. \documentclass[english]{ltxdoc} @@ -42,7 +39,7 @@ \noindent {\Large drawing wordclouds \\[0.2cm]with \hologo{METAPOST} and Lua}\\[3cm] \parbox{0.6\textwidth}{ - \wordcloud[scale=2,rotate=0,margin=0.5pt,usecolor]{(Wordcloud,10);(\\hologo{METAPOST},6);(\\LaTeX,7);(Lua,4);(algorithm,3);(code,2);(mathematics,2);(CTAN,2);(mplib,4);(\\hologo{LuaTeX},4);(latexmp,3);(graphism,2)} + \wordcloud[scale=2,rotate=0,margin=0.5pt,usecolor]{(Wordcloud,10);(\hologo{METAPOST},6);(\LaTeX,7);(Lua,4);(algorithm,3);(code,2);(mathematics,2);(CTAN,2);(mplib,4);(\hologo{LuaTeX},4);(latexmp,3);(graphism,2)} }\hfill \parbox{0.5\textwidth}{\Large\raggedleft \textbf{Contributor}\\ @@ -51,8 +48,8 @@ } \vfill \begin{center} - Version 0.1, 2023, August, 9th \\ - \url{https://plmlab.math.cnrs.fr/mchupin/wordcloud} + Version 0.2, 2023, September, 7th \\ + \url{https://plmlab.math.cnrs.fr/mchupin/mchupin/wordcloud} \end{center} %% == Page de garde ==================================================== \newpage @@ -348,7 +345,7 @@ have the same options: \hologo{METAPOST}.} ; \item[\texttt{margin=}\meta{value with units}:] to adjust the margins (default \lstinline+0.3pt+) ; - \item[\texttt{rotation=}\meta{angle}:] to rotate (degrees) the words with + \item[\texttt{rotate=}\meta{angle}:] to rotate (degrees) the words with $\pm$\meta{angle} alternatively (default 0) ; \item[\texttt{usecolor}:] to use color for word drawing (boolean, default \lstinline+false+) as described in section~\ref{sec:colors} ; @@ -361,12 +358,19 @@ have the same options: Here an example: \begin{ExempleLaTeX} -\wordcloud[scale=1,rotate=45,margin=0.5pt,usecolor,colors={red!40,blue!40,green!20!black}]{(Wordcloud,10);(\\hologo{METAPOST},6);(\\LaTeX,7);(Lua,4);(algorithm,3);(code,2);(mathematics,2);(CTAN,2);(mplib,4);(\\hologo{LuaTeX},4);(latexmp,3);(graphism,2)} +\wordcloud[scale=1,rotate=45,margin=0.5pt,usecolor,colors={red!40,blue!40,green!20!black}]{(Wordcloud,10);(\hologo{METAPOST},6);(\LaTeX,7);(Lua,4);(algorithm,3);(code,2);(mathematics,2);(CTAN,2);(mplib,4);(\hologo{LuaTeX},4);(\texttt{latexmp},3);(graphism,2)} \end{ExempleLaTeX} +Since version 0.2, you could use any \LaTeX{} code to define words for the +wordcloud. In the definition of the \LaTeX{} command, \wordcloudpkg{} uses +\lstinline+\luaescapestring+ to deals with commands. For example, as far as we +know, this \wordcloudpkg package is the only wordcloud tool that could build a +wordcloud of mathematical formulas. + \begin{remark} -Because the list of words and weights is given to Lua, we have to escape the -\lstinline+\+ to use \LaTeX{} commands. + Because the \hologo{METAPOST} side uses \lstinline+textext+ command to build + words, \lstinline+\mplibtextextlabel{enable}+ is used to enable string labels + typeset via \lstinline+textext()+ instead of \emph{infont} operator. \end{remark} \subsection{Add ignored words} @@ -420,6 +424,13 @@ Some things to do: \item Add options for rotation of words. \end{itemize} +\section{History} + +\begin{description} + \item[v0.2 (09/2023):] Deal with \lstinline+\luaescapestring+ for list with + \lstinline+\wordcloud+. Typos in doc. + \item[v0.1 (08/2023):] First publication. +\end{description} \printbibliography \printindex \newpage diff --git a/graphics/metapost/contrib/macros/wordcloud/metapost/wordcloud.mp b/graphics/metapost/contrib/macros/wordcloud/metapost/wordcloud.mp index 6a69fb5191..13e3ec8b90 100644 --- a/graphics/metapost/contrib/macros/wordcloud/metapost/wordcloud.mp +++ b/graphics/metapost/contrib/macros/wordcloud/metapost/wordcloud.mp @@ -3,7 +3,7 @@ %% drawing wordclouds %% %% with METAPOST and Lua %% %% chupin@ceremade.dauphine.fr %% -%% Version 0.1 (aout 2023) %% +%% Version 0.2 (septembre 2023) %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This work may be distributed and/or modified under the conditions of diff --git a/graphics/metapost/contrib/macros/wordcloud/scripts/wordcloud.lua b/graphics/metapost/contrib/macros/wordcloud/scripts/wordcloud.lua index 209ab0ca71..8df2c5a405 100644 --- a/graphics/metapost/contrib/macros/wordcloud/scripts/wordcloud.lua +++ b/graphics/metapost/contrib/macros/wordcloud/scripts/wordcloud.lua @@ -4,7 +4,7 @@ %% drawing wordclouds %% %% with METAPOST and Lua %% %% chupin@ceremade.dauphine.fr %% -%% Version 0.1 (aout 2023) %% +%% Version 0.2 (septembre 2023) %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This work may be distributed and/or modified under the conditions of @@ -128,7 +128,6 @@ function wc_build_mp_code(table_weight,maximum,rotation) ]] local i=0 for i=1, #tabular_weight do - str_mp=str_mp.."words["..i.."]:=\""..tabular_weight[i][1].."\";" str_mp=str_mp.."weights["..i.."]:="..tabular_weight[i][2]..";" if (i>=maximum) then @@ -175,7 +174,6 @@ end -- build mp code for the wordcloud of a list given in LaTeX command function wc_build_wordcloud(str,rotation,scale,margin,usecolor,colors) - maximum = maximum or 50 local table = wc_list_to_table(str) local lgth_table = wc_size_of_table(table) diff --git a/graphics/metapost/contrib/macros/wordcloud/tex/wordcloud.sty b/graphics/metapost/contrib/macros/wordcloud/tex/wordcloud.sty index 6fce2b03d9..378a8da315 100644 --- a/graphics/metapost/contrib/macros/wordcloud/tex/wordcloud.sty +++ b/graphics/metapost/contrib/macros/wordcloud/tex/wordcloud.sty @@ -3,7 +3,7 @@ %% drawing wordclouds %% %% with METAPOST and Lua %% %% chupin@ceremade.dauphine.fr %% -%% Version 0.1 (aout 2023) %% +%% Version 0.2 (septembre 2023) %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This work may be distributed and/or modified under the conditions of @@ -14,13 +14,13 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e}% \def\PackageName{wordcloud}% -\def\fileversion{v0.1}% +\def\fileversion{v0.2}% \def\filedate{2023/07/26}% \ProvidesPackage{wordcloud}[\filedate\space\fileversion]% % % package to load \RequirePackage{luamplib}% - +\mplibtextextlabel{enable} % to allow LaTeX in list of words inside LaTeX document % % load the lua code \directlua{require("wordcloud.lua")}% @@ -55,7 +55,7 @@ % mandatory argument : list (word1,weight1);(word2,weight2);etc. % optional arguments : % scale=<value> (default 1) - % rotation=<value> (default 0) + % rotate=<value> (default 0) % margin=<value> (default 0.3pt) % usecolor=true/false (default false) % colors={color1,color2,etc} @@ -88,7 +88,7 @@ %\show {coucous} \directlua{% %tex.sprint("test") - wc_build_wordcloud("#2",\tl_use:N \g__wc_wordcloud_rotate_tl,\tl_use:N \g__wc_wordcloud_scale_tl,"\tl_use:N \g__wc_wordcloud_margin_tl",\bool_if:NTF \g__wc_wordcloud_usecolor_bool{"true"}{"false"},"\tl_use:N \l_colors_list_tl") + wc_build_wordcloud("\luaescapestring{\unexpanded{#2}}",\tl_use:N \g__wc_wordcloud_rotate_tl,\tl_use:N \g__wc_wordcloud_scale_tl,"\tl_use:N \g__wc_wordcloud_margin_tl",\bool_if:NTF \g__wc_wordcloud_usecolor_bool{"true"}{"false"},"\tl_use:N \l_colors_list_tl") }% } @@ -99,7 +99,7 @@ % wordcloud % optional arguments : % scale=<value> (default 1) - % rotation=<value> (default 0) + % rotate=<value> (default 0) % margin=<value> (default 0.3pt) % usecolor=true/false (default false) % colors={color1,color2,etc} @@ -146,4 +146,4 @@ } -\ExplSyntaxOff
\ No newline at end of file +\ExplSyntaxOff |