• Re: Color with simple picture environments

    From Peter Flynn@peter@silmaril.ie to comp.text.tex on Wed Nov 5 11:42:49 2025
    From Newsgroup: comp.text.tex

    On 12/10/2025 17:46, Jeff Barnett wrote:
    On 10/12/2025 6:17 AM, Julian Bradfield wrote:
    On 2025-10-12, Jeff Barnett <jbb@notatt.com> wrote:
    On 10/11/2025 2:18 PM, Julian Bradfield wrote:

    {\color{red}\framebox(2cm,2cm){\color{black}text}}

    {\color{blue} \line....}

    I surely can't be the only person baffled that you don't seem to have
    tried doing this and found that it works.

    \documentclass{article}
    \usepackage[svgnames]{xcolor}
    \begin{document}
    \setlength{\unitlength}{10mm}
    \begin{picture}(10, 5)
    {\color{DarkBlue}\framebox(2,2){\color{ForestGreen}text}}
    \put(0, 0){\color{DarkRed}\line(1, 1){1} }
    \end{picture}
    \end{document}

    Peter
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Pieter van Oostrum@pieter-l@vanoostrum.org to comp.text.tex on Wed Nov 5 14:54:36 2025
    From Newsgroup: comp.text.tex

    Peter Flynn <peter@silmaril.ie> writes:

    On 12/10/2025 17:46, Jeff Barnett wrote:
    On 10/12/2025 6:17 AM, Julian Bradfield wrote:
    On 2025-10-12, Jeff Barnett <jbb@notatt.com> wrote:
    On 10/11/2025 2:18 PM, Julian Bradfield wrote:

    {\color{red}\framebox(2cm,2cm){\color{black}text}}

    {\color{blue} \line....}

    I surely can't be the only person baffled that you don't seem to have
    tried doing this and found that it works.

    \documentclass{article}
    \usepackage[svgnames]{xcolor}
    \begin{document}
    \setlength{\unitlength}{10mm}
    \begin{picture}(10, 5)
    {\color{DarkBlue}\framebox(2,2){\color{ForestGreen}text}}
    \put(0, 0){\color{DarkRed}\line(1, 1){1} }
    \end{picture}
    \end{document}

    Peter


    I guess the problem is that the framebox doesn't have a background color. To get a colored background you have to draw something, which naturally would be a rectangle (\rule in LaTeX).
    Here is a solution with a macro for this. It has 2 additional parameters (line color, background color). The coordinates (with, height) are not given as (w,h) here but as separate parameters. With some macro trickery this should be possible, but I think it is just distracting in this case.

    I included the pict2e packages because it gets you better pictures.
    Also the diagonal line comes out differently than Peter's because that one has a \put missing.

    \documentclass{article}
    \usepackage[svgnames]{xcolor}
    \usepackage{pict2e}

    % colored framebox % line color, background color, width, heigh, contents \newcommand{\cframebox}[5]{
    \put(0,0){\color{#2}\rule{#3\unitlength}{#4\unitlength}}
    \put(0,0){\color{#1}\framebox(#3,#4){#5}}
    }
    \begin{document}
    \setlength{\unitlength}{10mm}
    \begin{picture}(10,5)
    \put(0,0){\cframebox{DarkBlue}{yellow}{2}{2}{\color{ForestGreen}text}}
    \put(0,0){\color{DarkRed}\line(1,1){1}}
    \end{picture}
    \end{document}
    --
    Pieter van Oostrum <pieter@vanoostrum.org>
    www: http://pieter.vanoostrum.org/
    PGP key: [8DAE142BE17999C4]
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Jeff Barnett@jbb@notatt.com to comp.text.tex on Wed Nov 5 13:28:42 2025
    From Newsgroup: comp.text.tex

    On 11/5/2025 4:42 AM, Peter Flynn wrote:
    On 12/10/2025 17:46, Jeff Barnett wrote:
    On 10/12/2025 6:17 AM, Julian Bradfield wrote:
    On 2025-10-12, Jeff Barnett <jbb@notatt.com> wrote:
    On 10/11/2025 2:18 PM, Julian Bradfield wrote:

    {\color{red}\framebox(2cm,2cm){\color{black}text}}

    {\color{blue} \line....}

    I surely can't be the only person baffled that you don't seem to have
    tried doing this and found that it works.

    \documentclass{article}
    \usepackage[svgnames]{xcolor}
    \begin{document}
    \setlength{\unitlength}{10mm}
    \begin{picture}(10, 5)
    -a {\color{DarkBlue}\framebox(2,2){\color{ForestGreen}text}}
    -a \put(0, 0){\color{DarkRed}\line(1, 1){1} }
    \end{picture}
    \end{document}
    What I hoped to see as a response was a SIMPLE combination of the
    picture environment and a TRIVIAL to use coloring extension. I thought, incorrectly, that surely such a thing had been produced. Did you know
    that xcolor never mentions picture let alone provides an example? It
    spends dozens of pages on color models - something I learned about in
    the darkroom 50+ years ago. That was fortunate since it saved me reading
    50 or so pages of non-relevant material.

    There are 1000s of packages on CTAN, most I've never heard of an never
    will. I had hoped that one of the better informed folks who inhabited
    this forum could direct me to one that met my needs. Perhaps I should
    have included in my original message that I preferred using the pdf
    version of LaTeX; that would have meant I might not need to read about interfaces with drivers and so on and the final piping chain necessary
    to print the product after applying my favorite typesetting chain.

    An issue in LaTeX that seems to get worse with time is the diverging
    ways that one specifies optional parameters. They can appear in property
    name - property value motifs, square vs round brackets, comma separated
    lists, list of various sorts where position is significant, and on and
    on. Combining almost any two things can be painful. In simple fact I
    noticed no similarities between xcolor and and the picture environment.

    I had hoped, in this case, that someone with too much time on their
    hands had extended the picture environment so that color parameters
    could be slipped in where one might want to use them. It is fascinating
    that the TeX community has made it possible for knowledgeable scientist (knowledgeable in their own field) to easily, one might say trivially,
    draw pictures of chemical structures, tensors mixed into categories, and
    DNA fragments but drawing simple lines and boxes with labels diagrams in
    color is pretty much a complete kludge.

    The TeX family has been such a success because the underlying engine and
    its supported language is powerful enough to do what is necessary. But
    there are a few other things to consider in that success:

    1) Knuth rigorously defined correct behavior of the language and implementation so one knew when a new implementation worked and when it
    did not.
    2) Probably of equal if not more importance is Knuth avoided the
    mistake that so many computer geeks make - he didn't assume that he
    could pickup another complex field on the fly, he spent a big chunk of
    time acquiring real expertise in typesetting and related areas.
    3) Lamport's LaTeX contribution made it possible for us lessor folks
    to get almost all of the benefits of using TeX without the pain of
    learning tons of despised minutia that have little to do with the
    creation of the most important part of a document - its content.

    Point 3 above is really (actually really really) important. If there was
    no LaTeX, TeX might still be around but would have all but disappeared
    into the publishing houses. Possibly they would have developed
    competitive versions by copy and making individuating changes to TeX to
    avoid issues of ownership disputes. Using TeX can be fun and challenging
    but solving (formatting, etc.) problems in Tex is puzzle solving, not
    creating a document per se.
    --
    Jeff Barnett

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Richard Heathfield@rjh@cpax.org.uk to comp.text.tex on Wed Nov 5 21:42:09 2025
    From Newsgroup: comp.text.tex

    On 05/11/2025 20:28, Jeff Barnett wrote:

    <impassioned rant snipped>

    You took the words right out of my mouth, and then you said them
    so much better.

    Using TeX can be fun and challenging but solving (formatting,
    etc.) problems in Tex is puzzle solving, not creating a document
    per se.

    I have long since lost count of the hours I have wasted trying to
    do something that should be trivial but isn't., and I have had to
    adopt a rule: set a timer that will beep out loud. If you haven't
    found your answer in ten minutes, *give up* and re-word.
    Otherwise, you'll *never* get to The End.

    LaTeX is absolutely brilliant. But the docs, quite frankly, are
    shoddy, and whoever writes them should hang their heads in shame.
    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Axel Berger@Spam@Berger-Odenthal.De to comp.text.tex on Wed Nov 5 22:52:09 2025
    From Newsgroup: comp.text.tex

    Richard Heathfield wrote:
    LaTeX is absolutely brilliant. But the docs, quite frankly, are
    shoddy, and whoever writes them should hang their heads in shame.
    Have you ever used anything but TeX and LaTeX? My mantra is, why can't documentation not be like that I'm accustomed to from LaTeX -- and why
    can't there at leat *be* any documentation at all.
    I friend has just been made professor and teaches programming. His
    solution for everything, which he teaches students and tries to teach
    me, is ask Chatgpt and finf a working solution through trial and error.
    When I say I want documentation that explains all possible parameters
    and at least lists all valid parameters, he looks at me like I was an
    idiot from Mediaval times.
    LaTeX documentation is exemplary. Not everyone writes likes Markus Kohm
    for Komascript, but at least everyone puts in the effort and tries his
    best.
    -- />\ No | Dipl.-Ing. F. Axel Berger Tel: +49/ 221/ 7771 8067
    \ / HTML | Roald-Amundsen-Stra#e 2a Fax: +49/ 221/ 7771 8069
    aX in | D-50829 K%ln-Ossendorf http://berger-odenthal.de
    / \ Mail | -- No unannounced, large, binary attachments, please! --
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Richard Heathfield@rjh@cpax.org.uk to comp.text.tex on Thu Nov 6 03:34:07 2025
    From Newsgroup: comp.text.tex

    On 05/11/2025 21:52, Axel Berger wrote:
    Richard Heathfield wrote:
    LaTeX is absolutely brilliant. But the docs, quite frankly,
    are shoddy, and whoever writes them should hang their heads
    in shame.

    Have you ever used anything but TeX and LaTeX? My mantra is,
    why can't documentation not be like that I'm accustomed to
    from LaTeX -- and why can't there at leat *be* any
    documentation at all.

    Good point well made. If the competition is that dire, then it
    is, and I am railing like a spoiled child who's never had it so
    good. Nevertheless, grump, grump, grump.


    I friend has just been made professor and teaches
    programming. His solution for everything, which he teaches
    students and tries to teach me, is ask Chatgpt and finf a
    working solution through trial and error. When I say I want
    documentation that explains all possible parameters and at
    least lists all valid parameters, he looks at me like I was
    an idiot from Mediaval times.

    LaTeX documentation is exemplary.

    No. Kernighan and Ritchie is exemplary. A reference /and/ a
    tutorial in just 272 pages, and the epitome of crystal clear
    exegesis. If LaTeX documentation were as good as K&R, *nobody*
    would have grounds for complaint.

    Not everyone writes likes Markus Kohm for Komascript, but at
    least everyone puts in the effort and tries his best.

    Zing! Another excellent point. People are doing this for free.

    Nevertheless! Grump, grump, grump. Grump, grump, grump...

    I appear to have overlooked the obligatory harumph.

    \emph{Harumph!}
    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Axel Berger@Spam@Berger-Odenthal.De to comp.text.tex on Thu Nov 6 08:30:08 2025
    From Newsgroup: comp.text.tex

    Richard Heathfield wrote:
    If LaTeX documentation were as good as K&R, *nobody*
    would have grounds for complaint.
    It was. Can't fault Lesley Lamport. And then came all those packages.
    -- />\ No | Dipl.-Ing. F. Axel Berger Tel: +49/ 221/ 7771 8067
    \ / HTML | Roald-Amundsen-Stra#e 2a Fax: +49/ 221/ 7771 8069
    aX in | D-50829 K%ln-Ossendorf http://berger-odenthal.de
    / \ Mail | -- No unannounced, large, binary attachments, please! --
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Peter Flynn@peter@silmaril.ie to comp.text.tex on Fri Nov 7 09:38:27 2025
    From Newsgroup: comp.text.tex

    On 05/11/2025 21:42, Richard Heathfield wrote:
    [...]
    LaTeX is absolutely brilliant. But the docs, quite frankly, are> shoddy, and whoever writes them should hang their heads in shame.

    It depends which docs you are referring to. I agree that package
    documentation (the PDF that comes with every package) is often poor, but
    you have to remember the authors are volunteers who do this for fun, not profit; they may be programmers or document engineers rather than end
    users; English may not be their native language; and in any case the
    vast majority are not professional documenters.

    The books and articles about LaTeX are usually of a much, much higher
    quality.

    Most of the package authors are very welcoming of suggestions for
    improvement, and everyone would welcome better documentation anyway.

    Peter
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Peter Flynn@peter@silmaril.ie to comp.text.tex on Fri Nov 7 09:38:49 2025
    From Newsgroup: comp.text.tex

    On 05/11/2025 20:28, Jeff Barnett wrote:
    [...]
    What I hoped to see as a response was a SIMPLE combination of the
    picture environment and a TRIVIAL to use coloring extension.

    That is EXACTLY what I posted before: a 9-line file that demonstrates
    (1) a simple picture environment
    and
    (2) the use of the \color command.

    I'm not clear how much more simply it can be expressed.

    If you don't consider \color to be trivial, then I don't think anyone
    can help you more.

    I thought, incorrectly, that surely such a thing had been produced.

    It is what I posted.

    Did you know that xcolor never mentions picture let alone provides
    an example?
    Why would it mention the picture environment? Package documentation is designed to tell you how its commands work, and unless they warn you otherwise, they work in all LaTeX packages. There is nothing to mention.

    It spends dozens of pages on color models - something I learned
    about in the darkroom 50+ years ago.
    Me too. I find it valuable to be able to point newcomers to the science
    of colour at the descriptions. Most users are wholly unaware of this,
    and the reference point is useful.

    There are 1000s of packages on CTAN, most I've never heard of and
    never will.

    I've been using LaTeX since it started, and I also don't know the
    majority of packages. I don't think that's relevant.

    I had hoped that one of the better informed folks who inhabited
    this forum could direct me to one that met my needs.

    We have done exactly that: we showed you the xcolor package and its
    \color command, which does exactly what you asked for.

    I don't understand what more you are looking for rCo perhaps you could describe what you want that \color does not do.

    Perhaps I should have included in my original message that I
    preferred using the pdf version of LaTeX;
    No, every version of LaTeX except the original (now largely obsolescent) produces PDF by default: there is no need to mention it.

    If you meant you use the pdflatex program, that is being superseded by LuaLaTeX, but within the circumstances of your requirements, both do
    exactly the same.

    that would have meant I might not need to read about interfaces with
    drivers and so on and the final piping chain necessary to print the
    product after applying my favorite typesetting chain.

    I'm sorry, I must have missed that. I don't have any interfaces with
    drivers, or any pipe needed to print except clicking on Print in my PDF viewer. What drivers and piping chain are you referring to?

    An issue in LaTeX that seems to get worse with time is the diverging
    ways that one specifies optional parameters.

    No, optional parameters are always in square brackets.

    They can appear in property name - property value motifs,
    I'm not sure what those are.

    square vs round brackets,

    Square brackets are for optional parameters.
    Round brackets are rare, and used mostly for (x,y) coordinates in
    drawing diagrams.
    Curly braces are for mandatory values.

    comma separated lists,

    That's a different thing.

    list of various sorts where position is significant,

    The only one I encounter regularly is in the \includegraphics command,
    and it is well documented.

    Combining almost any two things can be painful.

    Getting them wrong certainly can be :-)

    In simple fact I noticed no similarities between xcolor and and the
    picture environment.

    I don't understand that at al. There are no similarities between picture
    and xcolor because there are no similarities between picture and xcolor.

    picture is a LaTeX environment for drawing simple diagrams;
    xcolor is a package for adding color to your document.

    You don't have to use picture if you don't want to draw diagrams (but
    you might want xcolor if you want colors somewhere in your document. Conversely, you don't have to use xcolor if you don't want any color
    except black; nothing to do with drawing diagrams at all.
    I had hoped, in this case, that someone with too much time on their
    hands had extended the picture environment so that color parameters
    could be slipped in where one might want to use them.

    Ah. You expected color to be automatically available wherever picture
    was used? LaTeX doesn't automatically include features that most users
    don't need, to avoid filling up your document processing with unwanted features. For example, the facilities to add images are not included by default. You have to use the graphicx package to get them. This is what
    keeps LaTeX fast and small.

    If you frequently need color in your picture diagrams (without moving to
    TikZ, which is much bigger and more powerful than picture, but of course
    much more complex and takes longer to learn), you can always borrow the
    source code of the picture commands and modify them to accept an
    optional colour argument. You would need to learn something about the internals of TeX and LaTeX, which is not something the average user
    might want.

    It is fascinating that the TeX community has made it possible for knowledgeable scientist (knowledgeable in their own field) to
    easily, one might say trivially, draw pictures of chemical
    structures, tensors mixed into categories, and DNA fragments but
    drawing simple lines and boxes with labels diagrams in color is
    pretty much a complete kludge.

    It's open to you to rewrite the relevant commands into a package which implements color in a way you find more acceptable. The fact that in 40
    years no-one has thought it necessary indicates to me that the existing mechanism works.

    If you want to add color to pictures of chemical structures, tensors
    mixed into categories, and DNA fragments, I think you would need to use
    xcolor and the \color command anyway. LaTeX is built on the add-on
    principle: you start with the basics and add the packages needed to do
    what you want. The alternative is to pack everything in at the start,
    which is what Microsoft Word does.

    The TeX family has been such a success

    [snip] That's a really excellent description.

    Point 3 above is really (actually really really) important. If there
    was no LaTeX, TeX might still be around but would have all but
    disappeared into the publishing houses. Possibly they would have
    developed competitive versions by copy and making individuating
    changes to TeX to avoid issues of ownership disputes.

    Several commercial typesetting systems owe a huge amount to TeX, and
    some were even built by rewriting the TeX engine and building a
    different environment around it.

    Using TeX can be fun and challenging but solving (formatting, etc.)
    problems in Tex is puzzle solving, not creating a document per se.
    I think for most users rCo at least the ones I teach and for whom I wrote
    my documentation rCo seem to pick up the add-on package concept very
    easily, freeing them to spend their time writing rather than coding.

    Peter
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Axel Berger@Spam@Berger-Odenthal.De to comp.text.tex on Fri Nov 7 13:10:24 2025
    From Newsgroup: comp.text.tex

    Peter Flynn wrote:
    The books and articles about LaTeX are usually of a much, much higher quality.
    And for almost anything else books -- of any quality -- are either
    unavailable or prohibitively expensive. This goes for anything Microsoft
    of "Office". One very positive exception is Gnuplot.
    -- />\ No | Dipl.-Ing. F. Axel Berger Tel: +49/ 221/ 7771 8067
    \ / HTML | Roald-Amundsen-Stra#e 2a Fax: +49/ 221/ 7771 8069
    aX in | D-50829 K%ln-Ossendorf http://berger-odenthal.de
    / \ Mail | -- No unannounced, large, binary attachments, please! --
    --- Synchronet 3.21a-Linux NewsLink 1.2