astoff / tikz-cd

Commutative diagrams with TikZ
45 stars 3 forks source link

Implications of the license for documents using tikz-cd #11

Closed maltesl closed 8 months ago

maltesl commented 3 years ago

There is some disagreement about whether using a GPLv3 licensed package in a tex document implies that that tex document and the compiled pdf needs to be licensed under the GPLv3 as well. I myself find that moderately plausible, but I am not a lawyer. However I think it is clear from this uncertainty that (unless the strong copyleft effect with respect to documents using tikz-cd is desired) the GPL is not an adequate license for LaTeX packages. Perhaps it would be a good idea to re-license/dual-license tikz-cd under a free software license that is better suited to the LaTeX ecosystem, like the LaTeX Project Public License (LPPL), which is also a license used by pgf?

astoff commented 3 years ago

Okay, let me say upfront that if there exist a substantiable concern about this, I'll change the license appropriately.

Now, I find the arguments linked above very strange. TeX is obviously not a compiler, since it doesn't output a program. It outputs data. It's analogous to Gimp, AbiWord and Audacity, all of which are GPL. Is there a real similar concern for those programs?

If .tex files are a kind of code, then TeX is an interpreter, not the compiler. The guy arguing that a LaTeX package is a library linked this FAQ. But just check the question just after that one, about interpreters.

Are you still worried? Like I said, I don't want the package to be in a grey area. But can you provide some more compelling considerations against the GPL in this case?

maltesl commented 3 years ago

Thanks for the response!

There are some arguments similar to what you wrote in the discussions I linked, but I do not think the analogy to GIMP holds quite like you write, at least not with the conclusion that tikz-cd's being licensed under the GPL can't "infect" tex documents that use it.

I try to cover a couple of points thoroughly and one by one so hopefully we can get down more precisely to where we might have differing views. I apologize that this might be a bit of a long read.

To start with, I think the distinction between compilers which output executables and things like TeX or GIMP which output other types of data is irrelevant. The GPL actually defines "program" (see 0. Definitions) to mean "any copyrightable work licensed under" the GPL. In all these examples we have some kind of "transformer" which one uses to convert input data to some kind of output. In the case of say a C program the transformer might be GCC, the input a file with C source code, and the output an executable ELF file. In GIMP's case the input might be xcf files (which also get created with input from me directly in the program, so that situation is slightly different), and the output an exported png file. In the case at hand I might use pdflatex/xelatex/... to transform tex and sty files to a pdf. In all of those cases I think the license of the "transformer" used does not impact what I can do with the output if I have copyright on the input, this is also explained here.

In the terminology of the GPLv3, the "source code" is the "preferred form of the work for making modifications to it" and "object code" is "any non-source form of a work". I think in the case of me writing a document with LaTeX, the source code is thus the tex and sty files (plus images etc. used) that are used as input, and the object code is for example the finished pdf.

So in the case of GIMP, I believe I have full rights to license say a png picture I created with GIMP in whatever license I want, and it has no impact that GIMP is licensed under the GPL. Similarly compiling a C program with GCC does not place restrictions on the binary, even though GCC is licensed under the GPL. Similarly, even if the input is only "run" like in the case of Perl, the interpreter being licensed under the GPL does not mean I need to license my Perl programs under the GPL, or say data generated by my program after running it with the interpreter. Similarly, I think if pdflatex/xelatex/... (or other tools that run behind the scenes when I invoke them) were licensed under the GPL, that would not place restrictions on licensing of my tex and pdf files (unless they copy parts of themselves into the output, which I am not aware of being the case). See here.

But in the example of GIMP, what happens if you provide me with a xfc file under GPL, I extract a layer to use as a background layer in my own image I draw with GIMP, and then I export that as a png? Then I believe I need to license this as GPL and make the source code (in this case my xcf file) available to whoever I distribute the png (which in this case is the object code) to. But as mentioned before, this is because the input, not the transformer was licensed under the GPL (it is just coincidence that the transformer GIMP also happens to be under the GPL). Generally, I think that transforming input data to output data retains the copyright, and if the input was licensed under the GPL the output must be licensed under the GPL as well (and the input is the "source code" of the output).

Similarly, if I were to use a Perl module licensed under the GPL in my Perl program (import it and then use some of its methods), then I need to license my program under the GPL as well, at least this is the FSF's position as specifically mention in the last two paragraphs here.

I think that doing \usepackage{tikz-cd} and then using tikzcd environments in my tex document could be considered to be analogous to the Perl case. From a programming-perspective as a user it certainly feels very similar: I include the module/package at the start, and then call it, in this case via the tikzcd environment and macros like \ar etc. Both my own code as well as tikz-cd's code are interpreted in just the same way while generating the pdf, and my code can not run without tikz-cd.

So I think that because of this I need to license my tex file under the GPL if it uses tikz-cd. Compiling it to a pdf file I believe might retain this situation, so if I distribute the pdf I need to make by tex source available as well, under the GPL.

Do you disagree with the FSF's opinion regarding using Perl modules that are licensed under the GPL? Or do you agree with the situation for Perl modules, but think the situation with LaTeX packages is different regarding the licensing of my source tex?

Perhaps one position one could take would be that this is analogous to the Perl case, and my source files need to be licensed under the GPL, but I can still distribute the pdf as I want, because this is like me using your Perl module in my Perl program that calculates something. Creating the pdf is then like running this program, and the output does not inherit the copyright of the program? But I definitely think that I have copyright on the output pdf, and I also think that if I license my tex file under the GPL and someone makes private modifications, and then distributes the pdf, then I should still have a copyright claim on the pdf and can thereby demand that they make their modifications available under the GPL. But perhaps one could argue that tikz-cd's contribution to the pdf does not rise to the level required to make a copyright claim on the pdf. I do not know enough about copyright law (and different countries also have different copyright law) to know how that would be viewed. But as an example, say I made a contribution to a software project in which I did not change the functionality of the executable, but refactored the code significantly. I would expect that this allows me a copyright claim also on compiled binaries using these modifications, even if this binary does not have any new functionality (or run faster etc.), assuming that the refactoring causes the resulting binary to be non-identical. In the case at hand, it seems at least plausible to me that tikz-cd's copyright transfers to some degree to the pdf in some jurisdictions. In this case the pdf also can not be regenerated looking the same way without using tikz-cd.

I am not completely convinced about the pdf situation, but as I said in my original comment, I am not arguing that the pdf is definitely infected by tikz-cd's GPL license, only that there is legal uncertainty placing this in a gray area.

In any case, I think the case that tikz-cd's GPL license infects my tex file is significantly stronger, which might also not be intended. For example when uploading to the arXiv, one usually uploads the tex source, and that kind of distributing would then imply that one needs to license that under the GPL.

Your analogy with GIMP seems to suggest to me that perhaps you see this more like \usepackage{tikz-cd} is like a configuration setting with which I instruct pdflatex/xelatex/... to make use of tikz-cd, as something that is more like a plugin to pdflatex/xelatex/..., assisting into transforming the input data (my tex and sty files, but not tikz-cd's tex and sty files) into the output data (the pdf), without impacting the licensing of that data. Is this how you see it? If so I will have to think about this some more. I currently do not find this interpretation very plausible, my impression is that my own style package gets included and processed in exactly the same way as tikz-cd's, and so if tikz-cd is to be interpreted as merely a compiler plugin, where would we draw the line? Perhaps my own mythesis.sty is then also such a compiler plugin. As it interacts with tikz-cd, we might have just gone in a circle and arrived back at the same problem as before anyway, just that my code and tikz-cd are now not combined as inputs to pdflatex/xelatex/..., but as plugins to it. But this interpretation seems very confusing to me.

I also want to say that I am in general a supporter of copyleft licenses and have several times in group projects argued for using "GPLv3 or later" as a license, so this issue should not be taken to mean I dislike the GPL, I just think that it is not well suited for LaTeX packages and leads to legal uncertainty in this case (judging from your response it seems clear that you do not intend the hypothetical effect we are discussing).

Part of the reason it is important to me to clear this up is also because in the case of for example a Python library, if I write a Python library which I decide to license under the GPLv3 rather than the LGPLv3, then I actively want that other programs that import and use it need to also be licensed under the GPLv3. If others then use my library without doing so I want the option of telling them they are infringing and not in compliance with my library's license. But then I think I should be consistent with this myself in a situation that I think is analogous.

I am currently writing up my PhD thesis in mathematics, and actually went through all packages I use directly to check what their license is. Nearly all were licensed under some version of the LPPL, then there were some fonts under the SIL Open Font License, and a couple under more permissive licenses (MIT, "do whatever you want"). And then there was precisely one package using the GPL, tikz-cd.

If you want to retain the kind of copyleft that the GPL has, then I think switching to the LGPL would significantly improve the situation. That license also wasn't written with the peculiarities of TeX in mind, but in the situation with the Perl modules I think the LGPL does not require a program using a module to be licensed under the GPL or LGPL, and so I think this also wouldn't be the case for using tikz-cd.

astoff commented 3 years ago

Fine. I agree that TeX is pretty unique in that the boundary between the engine code, the styling and the content is mixed up. LaTeX sort of fixes that, introducing a logical markup, different extensions for packages and user input, \makeatletter, etc.

But, as I said, I don't want the package to be in a grey area, even if I think there's no need to worry. So I just changed the license to LPPL.

This also prompted me to bump the version number to 1.0. Let me know if you spot something awry. I'll submit to the CTAN soon, but not immediately.

PS: We met at the SYM conference, remember?

PPS: If you think .tex files are code, you should check out Digestf.

maltesl commented 3 years ago

Perfect, thanks! Looks good to me.

We met at the SYM conference, remember?

Wow, how small the math world is :). tikz-cd seems like such a standard tool everyone uses, I hadn't even considered that I might have run into the author before...

If you think .tex files are code, you should check out Digestf.

Thanks, that looks quite useful.