posts
I often use a command like this:
$ pdfjam --a4paper -o "$pdf" "$png"
The input png file is 105kb and the resulting pdf is 97kb. The beauty and strength of pdfjam is that it uses pdfpages to simply insert images as they are without manipulation (whereas most other tools such as ImageMagick insist on transcoding images).
So what explains the fact that the output is smaller? If some kind of non-lossy compression is used within the PDF container, the PNG should not be that significantly compressable, I would think. Otherwise that would imply a notable inefficiency in the png algorithm.
I am writing a new package that does not use tikz but uses the standard latex2e picture environment. I am pleased that I could get the needed graphics without tikz. This means when the general public uses the package, it will not impose a tikz dependency on them (which is big and can have side-effects).
The problem is that objects need to be placed in absolute positions independant from other text on the page and without affecting other objects, like fold marks on a letter.
A similar question was answered:
It’s not a great answer because it relies on importing an external package (tikzpagenodes). We should not have to pull in the whole tikz infrastructure just to (for example) place a fold mark on a page. This is my starting attempt:
\setlength{\unitlength}{1mm}
\begin{ocg}{foldmarks}{fm}{on}\color{red}
\noindent\hspace{\dimexpr(-\oddsidemargin-1in)}\begin{picture}(0,0)
\put(0,0){hello, this is the origin!}
\end{picture}
\end{ocg}
The “h” in “hello” is rightfully against the far left edge of the paper. It’s ugly that I had to subtract off a left margin and an arbitrary 1 inch (which is hard-coded into the page layout), but it works for the horizontal. Doing the same with a negative \vspace{} (e.g. \vspace{\dimexpr(-\footskip-1in)}) has no effect, so a bottom margin or footer is forced.
How can this be overcome without using tikz?
I started the ground work for making an A4 origami envelope pkg to support this origami folding technique, which I previously mentioned here. This is my code so far:
\documentclass[paper=a4, DIV=34, footinclude=false, firstfoot=false]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} % suggested to avoid ``OT1 encoding''
\usepackage[fontsize=12.2pt]{fontsize} % furnishes \changefontsize but tampers with picture environment coordinate positions!
\usepackage[grid, gridunit=mm, gridcolor=blue!40, subgridcolor=blue!20]{eso-pic} % Makes a grid covering the whole page
\usepackage{graphpap}
\usepackage{overpic} % needed for rotatebox (WTF?)
\usepackage{ocgx2} % furnishes the ocg environment
\usepackage{nopageno} % suppress page numbering (because pagenumber=false doesn't work)
\usepackage{fancybox}
\usepackage{lipsum}
\begin{document}
\setlength{\unitlength}{1mm}
\begin{ocg}{fold marks}{fm1}{on}\color{red}
\begin{picture}(0,0)
\put(136,7){\setlength{\fboxsep}{0pt}\fbox{\rule{0.2pt}{1ex}}}
\put(94,-136){\setlength{\fboxsep}{0pt}\fbox{\rule{1ex}{0.2pt}}}
\put(188,-136){\setlength{\fboxsep}{0pt}\fbox{\rule{1ex}{0.2pt}}}
\end{picture}
\end{ocg}%
\lipsum
\newpage
\rotatebox{-45}{%
\setlength{\unitlength}{1mm}
\begin{picture}(106,155)(-30,35)
\begin{ocg}{gridlines}{grid}{off}
\graphpaper[5](0,0)(105,155)
\put(105,0){X\textsuperscript{max}}
\put(0,155){Y\textsuperscript{max}}
\put(105,155){XY\textsuperscript{max}}
\end{ocg}
\begin{ocg}{region boundaries}{rb}{on}
\put(25,0){\color{blue}\thicklines\line(-1,1){25}}% line bisecting the leftmost square to mark off a small triangle that wraps to the other side
\put(-16,0){\color{blue}\rule{41mm}{2pt}}
\put(-20,25){\rotatebox{-135}{\color{blue}\rule{28mm}{2pt}}}
\put(105,130){\color{magenta}\thicklines\line(-1,1){25}}% line bisecting the rightmost square to mark off a small triangle that wraps to the other side
\put(80,155){\color{magenta}\rule{41mm}{2pt}}
\put(105,150){\rotatebox{-135}{\color{magenta}\rule{28mm}{2pt}}}
\put(0,25){\color{cyan}\thicklines\line(-1,1){98}}% big triangle, LHS, longest (hypotenuse) edge - which splits the backside diagonally
\put(-75,150){\color{cyan}\rule{75mm}{2pt}}
\put(100,0){\color{green}\rule{75mm}{2pt}}% big triangle, RHS, edge nearest the page bottom
\put(105,130){\color{green}\line(1,-1){98}}% big triangle, RHS, longest (hypotenuse) edge - which splits the backside diagonally
\end{ocg}
\begin{ocg}{region labels}{rl}{on}
\put(-80,80){\Huge\rotatebox{-45}{\ovalbox{concealed}}}
\put(150,70){\Huge\rotatebox{135}{\ovalbox{concealed}}}
\put(0,190){\Huge\rotatebox{0}{\ovalbox{concealed}}}
\put(50,-50){\Huge\rotatebox{0}{\ovalbox{concealed}}}
\put(50,50){\Huge\rotatebox{90}{\ovalbox{Top/Front}}}
\put(100,20){\Huge\rotatebox{135}{\ovalbox{Bottom/Back RHS Triangle}}} % RHS: right-hand side
\put(-100,130){\Huge\rotatebox{-45}{\ovalbox{Bottom/Back LHS Triangle}}} % LHS: left-hand side
\put(-20,2){\small\rotatebox{0}{\ovalbox{Backside tiny triangle}}} % LHS: left-hand side
\put(85,152){\small\rotatebox{180}{\ovalbox{Backside tiny triangle}}} % RHS: left-hand side
\end{ocg}
\end{picture}
}
\end{document}
It works for me, as long as I use KOMAscript with a DIV setting of “34” and retain the fontsize package. This code is not suitable for packaging, for the general public, because the coordinates are fragile. Most people would not want to be constrained to the KOMAscript family of doc classes. Why the strange side-effects? Why aren’t the position instructions absolute?
TIL “Rectangular Micro QR” codes exist (since 2022). IMO this will drastically improve our docs that use QR codes. We will be able to use an rMQR as a kind of underline for an URL.
The standard is published here:
https://cdn.standards.iteh.ai/samples/77404/e103bf2d1f0d4162b34ca493efdaf9c4/ISO-IEC-23941-2022.pdf
The cons:
- no LaTeX pkg for rMQR
- no Debian pkg for rMQR (
qrencodecan do micro QR but not rMQR; OTOH, there is at least something - but non-Debian and only for obscure pkg managers) - alphanumeric charset ALL UPPERCASE - bummer!
Sadly, they fucked up again on this new standard by making all characters uppercase in the alphanumeric dataset. WTF? I have to say that’s even more mildlyinfuriating because the square QR codes have the same shitty limitation. Why didn’t they think this through? It would have been a good way to have small QRs that could be either all lowercase or all uppercase.
I find the clumbsy oversight worthy of a “crappy design” spotlight.
update
Worth noting that a split mode is possible and some encoders can handle that. You can have an all uppercase http://somedomain.tld/ using the alnum charset, then switch to 8-bit mode for a lowercase path that follows it. Still shitty design though.
All uppercase text is unreadable and ugly as fuck. But it is what it is.. if you typeset QR codes and can work within a small character set, you’re trapped with all uppers.
So then the question is, what can be safely converted to all uppercase without breaking? Apparently schemes, domain names and email addresses.
But what about the path? Nope, we’re fucked on that:
https://overflow.ocus.top/exchange/webmasters/questions/90339/why-are-urls-case-sensitive
OTOH, sometimes we get lucky
Ultimately a stupid decision by the QR designers indeed. Hence the cross-posting to !asshole_crappy_design@slrpnk.net. The bulkier the text, the more useful it is to use the smaller char set. But the bulkier it is, the more unpleasant it is to read all uppercase.
cross-posted from: https://lemmy.sdf.org/post/59173863
PDF layers can be created such that they display on the screen but are withheld when printing. This code should disable the OCG layers from printing:
\usepackage[printocg=never]{ocgx2}When compiling a doc with the above and printing this way:
lp $mypdfThe layers still print. It’s unclear if latexpdf is failing to generate the PDF correctly (i.e. a bug in the
ocgx2pkg), or if thelpcommand is failing to treat the PDF correctly. It’s worth noting that theocgx2documentation is non-existent/minimal. It seems to be a fork ofocgxwhich extendsocg-p. Theocgxdocs state generally thatocg-poptions are supported.
cross-posted from: https://libretechni.ca/post/1944375
If you scan paper receipts which you will then later submit copies of (either to your accountant, to a tax auditor, or to your employer), it is often useful to organize them on a PDF or to print them.
Today’s FOSS tools leave a lot to be desired. We have:
- ImageMagick’s montage app, which lacks a smart rectangle-fitting algo. The user must specify which images to tile in what order. Not even sure it’s sophisticated enough to not overlap images after the first row when different dimensioned images are involved.
- LaTeX is manual labor intensive. You must micromanage the orientation and position of images.
- Arranged by hand when scanning: probably even more manually intensive than LaTeX because it requires a steady hand to precisely place the images.
Human limitations will often likely have some paper waste due to inefficient placement. A clever algorithm could determine orientation and placement of each receipt to optimise minimisation of whitespace, thus wasting less paper.
A receipt-specific montage algo could detect the font size of each receipt and either shrink or enlarge depending on user-supplied constraints. The goal should be as few A4, A3, or US letter pages as possible, but then enlarge receipts to make better use of the available page space.
In principle, someone with a big brain creates an algorithm distributed as a library. Then ideally there would be an app that uses the library to generate LaTeX code. There could also be an enhancement to ImageMagick’s montage app to do the same.
Rectangle Repacking
After the rectangle packing app is created, it would then be useful to have an app that does the opposite. We arbitrarily put many receipts on the glass for scanning. Some receipts might not relate to others with respect to who it is presented to. A GUI app would accommodate drawing many boxes to mark the boundaries of each receipt and give a way to assign a filename to each box and write the files. Then any selection of resulting files could be fed into the rectangle-packing app. ATM we have to use GIMP to crop a single box, write the file, then reload the original image and repeat for each receipt, taking care to remember what was already cropped.
This letterfu site has PDF templates for folding a letter into a self-contained envelope. Could be quite useful but not great that we need to hand-write the address info. Would be useful if a LaTeX letter pkg could do the complex fold lines and addressing for us.
Update
Anyone who is inspired by this project idea might also find these folding approaches interesting, apart from the link of the thread:
- 3 methods for Origami envelopes (perhaps only the 1st technique works on recangular/A4 paper)
- Irregular-but-symmetric hexagon result from A4 paper
I would like to find a good forge to host a latex package. Not Github. Fuck Microsoft.
CTAN.org shows the repo for each of the packages known to CTAN, but I am struggling to get a list of repos. It seems we can only see one repo at a time by visiting each package individually. There is no public dataset, correct?
It would be useful to see which forge is the most popular (after nixing github).. or whether there is a gitea forge that is TeX-focused.
There is an API to make it easy enough to harvest the CTAN DB → https://ctan.org/help/json
cross-posted from: https://sopuli.xyz/post/42362772
The MS Windows and Apple boot-licking communities have ABBYY FineReader. It does not produce LaTeX but it’s very slick and useful, as I mention here.
There is a linux CLI version but it’s not FOSS. It’s apparently not even software. It seems to just be a client that depends on a cloud service. So you have to trust them with your data and pay them too. Fuck all that, obviously.
IIUC, the library is FOSS 🎉
But what uses that NeoML library? If ABBYY’s FineReader uses it, then it’s the right logic.. so the hardest work may be done already. We just need a tool to use it. Docs are here -- and they’re a bit over my head.
A FOSS app could perhaps use NeoML and produce LaTeX output, which can then be edited.
Would someone please make that for me? 🙏
Suppose I have a fingerprint to a public key like this:
b1946ac92492d2347c6235b4d2611184
If I just drop that verbatim in a doc, it’s obviously an ergonomic struggle for someone who has to verify those numbers against what they see in an app. So it should be presented as something like this:
b194 6ac9 2492 d234 7c62 35b4 d261 1184
But if we manually add a space every 4 chars, that’s embarrassing manual labor for a nerd. Self-respecting nerds make the tool do the work for us.
This code does the job:
\newcommand{\mkergo}[2][$\cdot$]{% The mandatory arg is a fingerprint; the optional arg is the delimiter between 4-char groups
\StrLen{#2}[\fplen]
\newcounter{ilpos} % internal left position
\newcounter{irpos} % internal right position
\setcounter{irpos}{4}
\whiledo{\not\value{irpos}>\fplen}{%
\setcounter{ilpos}{\value{irpos}-4}
\wlog{lpos::rpos is [\arabic{ilpos}..\arabic{irpos}]}
\StrLeft{#2}{\value{irpos}}[\left]
\wlog{left is \left}
\StrGobbleLeft{\left}{\value{ilpos}}[\segment]
\wlog{segment → \segment}
\noindent\hspace{-32pt}\segment\ifthenelse{\value{irpos}=\fplen}{}{#1}% WTF, why do we need neg hspace?!
\addtocounter{irpos}{4}
}
}
calling it looks like this:
\mkergo[\,]{b1946ac92492d2347c6235b4d2611184}
or
\newcommand{\fingerprint}{b1946ac92492d2347c6235b4d2611184}
\mkergo[\,]{\fingerprint}
It works but it’s still not something to be proud of because if the readable version of the fingerprint is needed in multiple places, that loop must run everywhere it is needed. It’s also really ugly that I had to add \hspace{-32pt} -- what the fuck for? Why is there a huge space between segments?
How can that code be improved? I tried creating a \prettyfp (short for pretty fingerprint) command and then having the loop extend that, so the \prettyfp can be used without rerunning the loop. But it’s got a logical error.. the last 4 chars just gets repeated over and over. This is the code:
\makeatletter
\newcommand{\spaceout}[2][$\cdot$]{% The mandatory arg is a fingerprint; the optional arg is the delimiter between 4-char groups
\StrLen{#2}[\fplen]
\newcounter{lpos} % internal left position
\newcounter{rpos} % internal right position
\setcounter{rpos}{4}
\whiledo{\not\value{rpos}>\fplen}{%
\setcounter{lpos}{\value{rpos}-4}
\wlog{S/O lpos::rpos is [\arabic{lpos}..\arabic{rpos}]}
\StrLeft{#2}{\value{rpos}}[\left]
\wlog{S/O left is \left}
\StrGobbleLeft{\left}{\value{lpos}}[\segment]
\wlog{S/O segment → \segment}
\g@addto@macro\prettyfp{\segment\ifthenelse{\value{irpos}=\fplen}{}{#1}}
\addtocounter{rpos}{4}
}
}
\makeatother
That was inspired by the 1st answer on this page.
What’s my problem?
How can this be improved?
Page 8 of the dot2texi manual gives this example:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}
\usepackage{dot2texi}
\begin{document}
% Define layers
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
% The scale option is useful for adjusting spacing between nodes.
% Note that this works best when straight lines are used to connect
% the nodes.
\begin{tikzpicture}[>=latex’,scale=0.8]
% set node style
\tikzstyle{n} = [draw,shape=circle,minimum size=2em,
inner sep=0pt,fill=red!20]
\begin{dot2tex}[dot,tikz,codeonly,styleonly,options=-s -tmath]
digraph G {
node [style="n"];
A_1 -> B_1; A_1 -> B_2; A_1 -> B_3;
B_1 -> C_1; B_1 -> C_2;
B_2 -> C_2; B_2 -> C_3;
B_3 -> C_3; B_3 -> C_4;
}
\end{dot2tex}
% annotations
\node[left=1em] at (C_1.west) (l3) {Level 3};
\node at (l3 |- B_1) (l2){Level 2};
\node at (l3 |- A_1) (l1) {Level 1};
% Draw lines to separate the levels. First we need to calculate
% where the middle is.
\path (l3) -- coordinate (l32) (l2) -- coordinate (l21) (l1);
\draw[dashed] (C_1 |- l32) -- (l32 -| C_4);
\draw[dashed] (C_1 |- l21) -- (l21 -| C_4);
\draw[<->,red] (A_1) to[out=-120,in=90] (C_2);
% Highlight the A_1 -> B_1 -> C_2 path. Use layers to draw
% behind everything.
\begin{pgfonlayer}{background}
\draw[rounded corners=2em,line width=3em,blue!20,cap=round]
(A_1.center) -- (B_1.west) -- (C_2.center);
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
It’s a broken example. gives:
ERROR: Package pgf Error: No shape named `C_1' is known.
An example in a manual should just work. What’s the problem?
Seems like a dead project. These two locations are mentioned in the manual and non-existent:
https://www.ctan.org/tex-archive/help/Catalogue/entries/dot2tex.html
http://www.fauskes.net/code/dot2tex/
(edit) CTAN location apparently moved here, but it may be out of maintenance:
https://www.ctan.org/pkg/dot2texi
All similare graphviz pkgs were last modified in 2018.
cross-posted from: https://lemmy.sdf.org/post/47352357
I’ve been producing sidebars to the left of a body of text using the
framedpackage, which only gives black results reliably. Thecolorframedpkg is a hackjob of patchwork that tries to fix color problems fromframed. But apparently it does not support a color leftbar. It’s a shame because I am creating a package that makes use of both leftbar andpdfcolparcolumns. Thepdfcolparcolumnscan do color vertical bars but it brings baggage and side effects. So I substitute\leftbarfromframedwhenparcolumnsscrews the pooch. But then I cannot color a leftbar fromcolorframedto matchpdfcolparcolumnsvertical rules.Guess I’m fucked.. not really interested in any complex options. If there is a decent drop-in solution I would be interested.
It would be useful to have a package for printing directly onto envelopes. The envlab pkg was a decent attempt, but I think the barcodes are not only US-only but also no longer relevent in the US. Barcodes appearing on mail lately are much longer and contain more info than just a zip code.
The barcode can be disabled, which is sufficient for basic use. But the tool has severe dimension limits. Even though you can specify an envelope of size 220×110mm, for example, the imaginary boundary box for the address is tiny. A street address that is 35 characters long gets wrapped.
Suppose you’re writing an anonymous letter. Nice looking LaTeX fonts would be a bad choice because they stand out and create quite a bit of uniqueness. I figure MS Word is probably the most popular. So I had a look at the wordlike package. It’s dated 2006 and gives an error on this line:
\renewcommand{\@dotsep}{1}
To hack around it, I tried putting this in my preamble:
\makeatletter
\newcommand{\@dotsep}{1} % hack to avoid wordlike.sty error
\makeatother
That attempt at a hack has no effect. Any ideas?
Regarding the click bait title.. I have not yet had the need for making ransom demands which should probably use a genuine MS Word. But whistle blowing should be quasi-pseudo-anonymous to some extent. I thought wordlike would suffice. Of course I’m open to other approaches. Maybe just switching to a sans serif font would do.
The last answer on this page looks interesting but does not work with pdflatex.. only XeTex. There is another non-wordlike approach on this page I might play with.
Update
It turns out the wordlike package is incompatible with the scrlttr2 class. So wordlike works if you give up the letter features.
A long-ass time ago I had a big heavy laser printer that was well documented. It only had a parallel (LPT) port (to give an idea of the age). The documentation gave various control codes that could be sent to the printer. I vaguely recall sending plain text to the port and controlling things like font size using the control codes that were specified in the printer manual. I suppose that was a driver-free mode of operation.
Some LaTeX doc talks about how to produce a DVI file with printer control codes inserted wherever you want. So imagine if you have a cover letter followed by a document you intend to enclose with the letter. You would not generally want the first page of the document to print on the backside of the cover letter, but you might still want the doc to use full duplex mode. In principle, you could have the lp command send it in simplex mode but inject a control character that switches to duplex mode after the first page.
Of course you can inject a deliberately blank page but that’s sloppy. The digital version should have no blanks and the printed version should have blanks in certain places. The \cleartooddpage command is good for the latter but the former. I suppose the caveat is PDFs are disadvantaged and likely cannot handle printer control signals the way DVI can.
Printer manuals apparently no longer acknowledge the existence of control codes. So have we lost a capability because manufacturers insist on dumbing everything down for the stupid masses?
What about driverless printers? The CUPS docs mention that CUPS will become driverless. I really hope that does not mean CUPS is going to obsolete my current driver-dependent printer. But in any case, does driverless imply that there will be a standard for controlling printers, so e.g. we can send a signal mid-printjob to switch to full duplex?
Anyone know of a template or sample doc that prints markers around the edge of an A4 paper?
Or even just a good centralised reference?
I can’t believe what shit results my searches are getting. Surely this must be a common need for millions of people. I am not going to go to the printshop, write down their printer model numbers, try to locate online manuals in an ocean of shitty manual sites, to try to dig up the printable area specs, which are likely untrustworthy anyway. I’ve done that before, and IIRC Canon specs were a lie.
Canons seem to have a quite large unprintable area. I know Ricoh does better. It would be useful to see a centralised table with the printable area specs of (at least) all the large industrial printers.
\documentclass[DIV=66, draft=true]{scrartcl} % The draft switch produces a ruler along the boundary of the printed space (which is controlled by the DIV value)
Update1: CUPS test print reveals unprintable area dimensions
It’s worth noting that the test page for CUPS gives “media limits” info. Which is vague but seems to correspond with the printer’s edge of printable area. It’s unclear if that comes from the printer driver or if the printer is somehow queried for that info.
This is of course only useful if you’re not using a print shop.
Update2: came up with code to generate a test print:
% Purpose:
%
% 1) Test whether the unprintable region documented in the printer specs is accurate.
% 2) If not, find the real dimensions.
% 3) Find the maximum DIV setting for the KOMAscript package that does not encroach into the unprintable area.
%
% Procedure:
%
% 1) Lookup the expected unprintable area dimensions for the printer under test.
% 2) Edit SetBgContents below to match the dimensions, which are added to (current page.*)
% 3) Trial and error/tuning: Set DIV=99 and compile. Then set DIV=9 and compile. Notice how the rectangle ruler gets smaller as DIV gets smaller. Find the max value for which the rectangle does not go outside of the violet rectangle.
% 4) With DIV at the max, fiddle with the size and position parameters of the large circle (in DeclareNewLayer). The goal is for the circle to touch the top and bottom edges of the paper.
\usepackage{scraddr}
\usepackage{scrlayer-scrpage} % needed for \cofoot
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} % suggested to avoid ``OT1 encoding''
\usepackage{pict2e}
\usepackage{scrlayer}
\usepackage[firstpage=true, color=violet]{background}
\usepackage{tikz}
\usetikzlibrary{calc}
% from another suggestion below:
\SetBgPosition{current page.north west}% Select location
\SetBgOpacity{1.0}
\SetBgAngle{0.0}
\SetBgScale{1.0}
% \SetBgColor{black}
% The line width setting below specifies 1pt but it really looks thicker compared to other lines. Nonetheless, it gives a good thickness for the job.
\SetBgContents{%
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=1pt]%,rounded corners=4pt,]
($ (current page.north west) + (4.2mm,-4.2mm) + (1pt,-1pt) $)
rectangle
($ (current page.south east) + (-4.2mm,4.2mm) + (-1pt,1pt) $);
\end{tikzpicture}}
% The following gives circles and must /follow/ the tikz stuff above.
\DeclareNewLayer[%
textarea,background,mode=picture,
contents={%
\putC{\circle{\LenToUnit{\paperwidth}}}%
\put(0.5\layerwidth,0.5\layerheight-3pt){\circle{\LenToUnit{\paperheight}-0pt}}%
}
]{showtextarea}
\DeclareNewPageStyleByLayers{test}{showtextarea}
\pagestyle{test}
\begin{document}
\phantom0 % There must be /something/ here or else 0 pages are generated. So we put an invisible phantom object.
\end{document}
cross-posted from: https://libretechni.ca/post/309317
There are probably thousands of LaTeX packages many of which are riddled with bugs and limitations. All these packages have an inherent need to interoperate and to be used together unlike any other software. Yet there are countless bizarre incompabilities. There are various situations where two different font packages cannot be used in the same document because of avoidable name clashes. If multiple different packages use a color package with different options, errors are triggered about clashing options when all the user did was simply use two unrelated packages.
Every user must do a dance with all these unknown bugs. Becoming proficient with LaTeX entails an exercise of working around bugs. Often the sequence of
\usepackagemakes the difference between compilation and failure, and the user must guess about which packages to reorder.So there is a strong need for a robust comprehensive bug tracking system. Many of the packages have no bug tracker whatsoever. Many of those may even be unmaintained code. Every package developer uses the bug tracker of their choice (if they bother), which is often Microsoft Github’s walled garden of exclusion.
Debian has a disaster of its own w.r.t LaTeX
Debian bundles up the whole massive monolithic collection of LaTeX packages into a few texlive-* packages. If you find a bug in a pkg like
csquotes, which maps totexlive-latex-extraand you report a bug in the Debian bug tracker for that package, the Debian maintainer is driven up the wall because one person has 100s/1000s of pkgs to manage.It’s an interesting disaster because the Debian project has the very good principle that all bugs be reportable and transparent. Testers are guided to report bugs in the Debian bug tracker, not upstream. It’s the Debian pkg manager’s job to forward bugs upstream as needed. Rightly so, but there is also a reasonable live-and-let-live culture that tolerates volunteer maintainers using their own management style. So some will instruct users to directly file bugs upstream.
Apart from LaTeX, it’s a bit shitty because users should not be exposed to MS’s walled garden which amounts to bug supression. But I can also appreciate the LaTeX maintainer’s problem.. it’d be virtually humanly unsurmountable for a Debian maintainer to take on such a workload.
What’s needed
- Each developer of course needs control of their choice of git and bug tracker, however discriminatory the choice is -- even if they choose to have no bug tracker at all.
- Every user and tester needs a non-discriminatory non-controversial resource to report bugs on any and all LaTeX packages. They should not be forced to lick Microsoft’s boots (if MS even allows them).
- Multiple trackers need a single point of review, so everyone can read bug reports in a single place.
Nothing exists that can do that. We need a quasi-federation of bug trackers giving multiple places to write bug reports and a centralised resource for reviewing bug reports. Even if a package is abandoned by a maintainer, it’s still useful for users to report bugs and discuss workarounds (in fact, more importantly so).
The LaTeX community needs to solve this problem. And when they do, it could solve problems for all FOSS not just LaTeX.
(why this is posted to !foss_requests@libretechni.ca: even though a whole infrastructure is needed, existing FOSS does not seem to satisfy it. Gitea is insufficient.)
Getting burnt by repair-hostile makers of washing machines who refuse to share documentation inspired this form letter (in LaTeX):
\documentclass[DIV=16]{scrlttr2}
%\LoadLetterOption{NF} % uncomment for French standard windowed envelope
%\LoadLetterOption{DIN} % uncomment for German standard windowed envelope
%\LoadLetterOption{UScommercial9DW} % uncomment for US standard double-windowed envelope
\usepackage{ragged2e} % needed to restore the loss of paragraph indents when \raggedright is used
\usepackage{hyperref}
\setlength{\RaggedRightParindent}{\parindent} % restore the loss of paragraph indents when \raggedright is used
\RaggedRight
\newcommand{\appliance}{washing machine} % replace with whatever you need to buy
\newcommand{\mfr}{Machine Maker} % replace with Whirlpool, or whatever
\newcommand{\mfrAddress}{123 sesame street\\90210} % replace with mfr address
\begin{letter}{%
\mfr\\
\mfrAddress}
\opening{Dear \mfr,}
I am in the market for a \appliance.
When I asked the local retailer (whose profession is to sell your products)
which \mfr\ models include service manuals, they were helpless.
Could not find a single machine that respects consumers and thus their right to repair.
Zero. Every product by \mfr\ in their showroom was anti-consumer.
There are no service manuals published on your website either.
When looking at various second-hand models, many basic user guides were missing as well,
apparently depending on the age of the unit.
I will not buy a disposable anti-consumer \appliance.
Those are for stupid consumers.
A \emph{\bfseries good} \appliance\ meets this criteria:
\begin{enumerate}
\item has a \emph{good} service manual which is available to anyone, free of charge
\item has no cloud-dependency (\emph{all} functionality accessible without Internet)
\item has no app, OR has a \emph{good} app
\end{enumerate}
A \emph{good} app satisfies this criteria:
\begin{itemize}
\item open source
\item requires no patronisation of Google or Apple to obtain
\item has an APK file directly on your website or on f-droid.org
\end{itemize}
A \emph{good} service manual meets this criteria:
\begin{itemize}
\item wiring diagram
\item parts diagram with part numbers
\item inventory of components including the manuafacturers and models, and functional resistence ranges (Ω)
\item error codes and their meanings
\item steps to reach diagnostic mode and steps to use it
\end{itemize}
Do you make any \emph{good} pro-consumer \appliance s with a good service manual, with no bad apps?
If yes, please send me the service manual and I will take your product seriously.
If not, you are sure to lose the competition.
If everyone else loses the competition as well, then I will continue washing my clothes by hand
-- perhaps with this repairable machine: \url{www.thewashingmachineproject.org}.
\closing{Sincerely,}
\end{letter}
I suggest sending that letter to every manufacturer making machines for your region. It will get no results but it will send the message they don’t hear enough of.
I often have a long itemised list of words that and short phrases that wastes a lot of page space. E.g.
- short
- short
- short
- short
- short
- short
- short
- short
- something a bit longer
- something a bit longer
- something a bit longer
- something a bit longer
- something a bit longer
- something a bit longer
- something a bit longer
- something a bit longer
Natural temptation is to code it like this:
\begin{multicols}{3}
\begin{itemize}[nosep,noitemsep,left=6pt] % nosep helps but still a little wasteful. We try noitemsep in vain.. has no effect
\item short
\item short
\item short
\item short
\item short
\item short
\item short
\item short
\item something a bit longer
\item something a bit longer
\item something a bit longer
\item something a bit longer
\item something a bit longer
\item something a bit longer
\item something a bit longer
\item something a bit longer
\end{itemize}
\end{multicols}
The multicols is claimed to be “balanced” but apparently that does not mean a balance of white space. It’s hard-coded to give each column an even share of width (⅓ of \linewidth). So it produces:
- short - short - something a bi
- short - short - something a bi
- short - short - something a bi
- short - something a bit l- something a bi
- short - something a bit l- something a bi
It’s even worse than that because the right column actually overlaps the center column and the right column runs off the page. All while a lot of wasted space is on the left column.
I doubt I can expect a pkg to be smart about max item widths for each column. But in principle I should be able to manually micromanage this and say make the left col “5em” wide, or something. The parcolumns package gives that control, but it botches itemised lists even more and would force me to break the list into 3 separate lists because it’s designed to give you control over where the column breaks happen.
The enumitem package suggests something along the lines of:
\SetEnumitemKey{threecol}{
itemsep = 1\itemsep,
parsep = 1\parsep,
before = \raggedcolumns\begin{multicols}{3},
after
= \end{multicols}}
(in effect) but same problem.
AFAICT, I will have to use parcolumns with norulebetween (because the vertical line is what screws up), and also make separate lists.. which is a bit sloppy code-wise.
I would expect this to be a common problem on CVs because you need to cram a lot of info in a small space and you would be listing skills which might involve many short words (C, C++, Java, Rust, Ada, Go, ..) along with some longer words (Fortran, Haskell, Cobalt, Pascal).
This thread suggests the vwcol package, but it’s even worse. The code:
\begin{vwcol}[widths={0.2,0.4,0.4}]
Yields a first column that uses the full width. I still have to try the flowfram and paracol packages.
Update
The paracol package seems like the best compromise. The layout gives control over a \columnratio variable. It will not decide for you where to end a column and start a new one. That can be a nuissance in some cases but welcome in others. In fact, it’s not much different than just coding a minipage for each column. Demo:
\documentclass{article} % minimal not used because the itemize environment lacks bullets
\usepackage[margin=6mm]{geometry}
\usepackage{paracol}
\usepackage{enumitem}
\usepackage{lipsum}
\usepackage{blindtext}
\begin{document}
\setlist{nosep} % nix whitespace from all lists globally (to affect the \blindlist in particular)
\columnratio{0.2,0.26}
\begin{paracol}{3}
\blindlist{itemize}[6]
\switchcolumn % start column 2
\begin{itemize}[noitemsep,left=6pt]
\item medium width item list
\item medium width item list
\item medium width item list
\item medium width item list
\end{itemize}
\switchcolumn % start column 3
\begin{itemize}[noitemsep,left=6pt]
\item \lipsum[1][1]
\item \lipsum[1][1]
\item \lipsum[1][1]
\item \lipsum[1][1]
\end{itemize}
\end{paracol}
The array package gives the capability to replicate a declaration before every cell in a specifed column column. So if you have a column for a price, you can use a format like: {ll>{\$}r} to put a dollar sign before every price.
Usually you want long dates in the text of a document (e.g. 5th August, 2021). Of course exceptionally you would usually want short dates in a table column. But this is broken:
\Begin{tabular}{l>{\DTMsetdatestyle{default}\DTMsetup{datesep=/}}rl}
col 1 && \DTMusedate{mydate} && col 3\\
\end{tabular}
The middle column still prints the long form of dates. It obviously clusterfucks the table to put the long-ass \DTMsetdatestyle{default}\DTMsetup{datesep=/} in every middle cell.
The only workaround I can think of is to nest the whole table inside braces ({}), and nest the date config with it:
{\DTMsetdatestyle{default}\DTMsetup{datesep=/}
\begin{tabular}{lrl}
col 1 && \DTMusedate{mydate} && col 3\\
\end{tabular}}
I’m calling it a bug because there is no good reason make code inside >{} happen in a separate scope as the cell that preceeds.
I want to produce a PDF that looks good on the screen in color. Of course if I do that well with color backgrounds and all, the same document will look lousy when printed on a monochrome laser printer. E.g. consider a text box with color background. The background will go through a dithering algorithm which often enshitifies the text layer on top of that. Likewise on mono e-readers.
In principle, the doc needs two different representations. One for color and one for mono. As rich as the PDF standard is, I don’t think I have ever seen a PDF with multiple modes. So LaTeX aside, does the PDF standard even support this?
I can think of a hack using PDF layers which is supported by the ocgx2 LaTeX package. Color backgrounds could be isolated to a switchable layer. This is not great though because the end user needs to be aware of the layer and must take a manual action to turn off the background layer before printing as black and white. And still, non-black foreground text will print as gray unless foreground text is in a layer too (yikes).
Am I S.O.L?
URLs can be long and ugly as fuck, littered with special LaTeX-reserved characters like “#”, “_”, “%”, “&”, “@”, “~”, …etc.
The hyperref package apparently does some sophisticated gymnastics to handle the special chars. The \url{} and \href{}{} macros work for most (if not all) chars. But it becomes a shit-show when the same URL is used in multiple places in multiple representations. E.g. I often need to have a hyperlink as a readable string that visits an URL when clicked. \href from the hyperref pkg does that. But of course the URL is lost when the doc is printed. So the URL needs to become a footnote, which means the shitty-looking ungodly long URL must be entered twice. For example, a first attempt might look like this:
The \href{https://lemmy.sdf.org/c/tex_typesetting}{TeX community}\footnote{\scriptsize\verb|https://lemmy.sdf.org/c/tex_typesetting|} is where we discuss `\LaTeX`.
There is an underscore, which probably has to be escaped in the \verb but not the \href (not sure ATM- it’s hard to keep track of all the exceptions). Of course it’s quite annoying that the URL appears twice. So the temptation to thwart redundancy leads to this:
\newcommand{\hardlink}[2]{\href{#1}{#2}\footnote{\scriptsize#1}}
Disaster, because some chars need to be escaped for the footnote but if you escape those same chars for the \href, the backslashes appear literally in the hyperlink which is broken as a result. Another problem is when using minipages to get two columns, the footnote width is cut in half thus forcing long URLs to wrap at the horizontal midpoint of the page instead of continuing and using the wasted footer space under the right column. \mbox fixes that. So after much fiddling with blind hacks like \urlescape, \noexpandarg, \normalexpandarg, and \expandafter, I arrived at this:
\newcommand{\hardlink}[2]{\href{#1}{#2}\footnote{\scriptsize\mbox{\detokenize{#1}}}}
The \detokenize works for some special chars but not others. So still a fuckin’ mess. A LaTeX wizard of sorts went off to work on this problem for me, and came up with this:
\makeatletter
% NOTE: The following is an ugly hack that temporary redefines an internal
% command of hyperref to process the verbatim URL. There is no warranty
% and no support for this code or documents using this code!
\newcommand*{\footnotelink}{%
\global\let\original@hyper@@link\hyper@@link
\let\hyper@@link\onetime@special@hyper@@link% ugly hack
\href
}
\newcommand*{\onetime@special@hyper@@link}[3]{%
\global\let\hyper@@link\original@hyper@@link% ugly hack
\hyper@@link{#1}{#2}{#3}%
\IfArgIsEmpty{#2}{\footnote{\tiny\nolinkurl{#1}}}{\footnote{\tiny\nolinkurl{#1\##2}}}%
}
\makeatother
That monstrosity is the nuclear option that works in most cases. But IIRC it still fucks up in some situations, so I must use a combination of \hardlink and \footnotelink.
But what about QR codes? Fuck me. Another dimension of the same problem. Producing a doc with QR codes but not the URL strips the reader of some dignity. But a footnote is a bad way to expand a barcode. The URL should appear close to the QR code so the reader need not hunt for it. But URL size and circumstances ensure we cannot simply make a macro that hard codes it. Every layout situation is different.
Having a bibliography section helps force a standard presentation, but that still requires the URL to be repeated and we don’t necessarily want to be forced to have a bibliography anyway.
What we really need is an URL database, which maps tokens to URLs in the preamble. Consider how the datetime2 pkg works. You can store a list of dates like this:
\DTMsavedate{event1}{2021-12-10}
\DTMsavedate{event2}{2022-02-21}
\DTMsavedate{event3}{2022-03-10}
…
\begin{document}
yada yada \DTMusedate{event1} yada yada \DTMsetstyle{ddmmyyyy}\DTMusedate{event3}…
lorem ipsum \DTMsetstyle{mmddyyyy}\DTMusedate{event2} lorem ipsum \DTMsetdatestyle{default}\DTMsetup{datesep=/}\DTMusedate{event1} …etc.
We need that for URLs. Simply making a \newcommand for each URL would not work because \qrcode, \href, \texttt, \verb and family of verbatim envs all treat the special chars differently and some do not even expand commands. It needs to be a macro that can probe its own user to know which chars to escape.
One of the markdown languages supports URL references. E.g. you can declare ergonomic names for the URLs:
[diseasePlusCure]: https://krebsonsecurity.com/2016/10/spreading-the-ddos-disease-and-selling-the-cure
[diseasePlusCure-ia]: http://web.archive.org/web/20230713212522/krebsonsecurity.com/2016/10/spreading-the-ddos-disease-and-selling-the-cure
[mislabelling-ia]: <http://web.archive.org/web/20211006120915/people.torproject.org/~lunar/20160331-CloudFlare_Fact_Sheet.pdf#page=3>
[fediThreat]: https://write.pixie.town/thufie/dont-trust-cloudflare
[fediThreat-ia]: http://web.archive.org/web/20230827161847/write.pixie.town/thufie/dont-trust-cloudflare
[testamony]: https://dragonscave.space/@BlindMoon38/111954315299607397
[personalisedPricing]: https://web.archive.org/web/20240601161454/http://robindev.substack.com/p/cloudflare-took-down-our-website
Then in the doc write: “Cloudflare exploits [personalised pricing][personalisedPricing]” so the shitty URL does not obnoxiously pollute the text.
A LaTeX approach could be:
\savelink{CloudflareLies}{http://web.archive.org/web/20211006120915/https://people.torproject.org/~lunar/20160331-CloudFlare_Fact_Sheet.pdf#page=3}
…
\begin{document}
Yada yada.. This QR: \uselink[form=qr, width=20mm]{CloudflareLies} leads to \uselink[form=fixedwidthfont,wrapping=false]{CloudflareLies}.
We have something that partially works and is not well documented. There is an url package and there is a hyperref package. The hyperref package is said to supercede the url pkg. In fact, hyperref uses the url pkg. So you would generally ignore the url pkg and just use hyperref. But the docs for hyperref conceal the existence of the \urldef command from the url pkg. The docs for url show that you can do this:
\urldef{\nastyurl}\url{http://www.musical-starstreams.tld/~william@orbit/very_long_using_underscores/and%20spaces/file+with^caret.pdf?arg1=x&arg2=y#page=5}
Then you can use \nastyurl throughout your doc, including inside footnotes. But it screws up when used inside \href (no wonder hyperref docs neglect to mention it). It also falls over when used inside \qrcode.