Skip Navigation
TeX typesetting

A place to share ideas, resources, tips, and hacks for Donald Knuths typesetting software TeX. All variants and formats like OpTeX, LaTeX and ConTeXt are welcome.

Tagging your post with [

<foo>

] is optional, but can help others to know if it uses or pertains to a certain format/engine/system.

Rules: Posts and comments should be civil and somehow related to *TeX and/or typesetting in general.

Members
106
Posts
7
Active Today
1
Created
2 yr. ago
  • TeX typesetting @lemmy.sdfeu.org
    LibreMonk @linkage.ds8.zone

    the font option produces PDFs that only render correctly in Adobe Acrobat, not Poppler (xpdf, evince, okular)

    This is the sample code (for LuaTeX or XeTeX):

     undefined
        
    \documentclass{scrartcl}
    
    \usepackage{pdfcomment}
    \usepackage[english]{babel}
    %\usepackage[latin1]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}
    \usepackage{microtype}
    \usepackage[svgnames,rgb]{xcolor}
    \usepackage[absolute]{textpos}
    \usepackage{amssymb,amsmath,array,bm}
    \usepackage{courier}
    \usepackage{calligra,mathptmx,helvet,concmath}
    \usepackage{times}
    \usepackage{fontspec} % used to access system fonts like Lucida Fax
    
    \begin{document}
    
    \defineavatar{standard}{height=10mm,width=15cm,type=freetext,color=white,fontsize=20pt,fontcolor=blue}%,voffset=-4.8cm,hoffset=-3.2cm}%
    
    \noindent%
    Fonts from the pdfcomment example document:\\[10mm]
    \pdffreetextcomment[avatar=standard]{This font is Helvetica (the default)}\\[6mm]
    \pdffreetextcomment[avatar=standard,font=LucidaConsole]{This font is LucidaConsole}\\[6mm]
    \pdffreetextcomment[avatar=standard,font=Georgia]{This font is Georgia}\\[6mm]
    \pdffreetextcomment[avatar=standard,font=P
      
  • TeX typesetting @lemmy.sdfeu.org
    quat @lemmy.sdfeu.org

    New trick to make sure margin notes don't overlap.

    OpTeX Tips and tricks section was updated with a macro that automatically makes sure that margin notes don't overlap. It's otherwise a problem when the margin notes are too close.

    If you want to do it manually you can use \mnoteskip, but this is an automatic way.

  • TeX typesetting @lemmy.sdfeu.org
    quat @lemmy.sdfeu.org

    Dealing with widows (and orphans if we want).

    Orphans and widows. On this subject Tschichold wrote:

    "Doubtless all textbooks of typesetting warn that the exit line of a paragraph at the head of a book page must be avoided at all cost. /.../ Is there really nothing we can tighten a little, or space out perhaps? Possibly we can save a line at the beginning of the chapter by moving the first paragraph up? The best method is to simply shorten the preceding page by a line."

    Bringhurst wrote:

    "Balance facing pages not by adding extra lead or puffing up the word space, but by exporting or importing single lines to and from the preceding or following spreads. The same technique is used to avoid widows, and to extend or shorten any chapters that would otherwise end with a meager few lines on the final page."

    In TeX we can set \widowpenalty (and \clubpenalty) to 10000 and if we have vertically stretchable material on the page the type area will get it's height, but lines will not match across the spread. Without strechable material that

  • TeX typesetting @lemmy.sdfeu.org
    quat @lemmy.sdfeu.org

    A Pragmatic Approach to Paragraphs, by Philip Taylor

    What's your method for dealing with underfull/overfull \hboxes and unacceptable badness in general?

    LaTeX has the \sloppy command which IIRC sets \tolerance to 9999, and \emergencystretch to a large value. But the default \tolerance is 200 (I think), which is a big difference. It's very "either/or" when maybe there's a more optimal way.

    For my native language (swedish) I've found that many issues arise because TeX doesn't find all the possible hyphenation points, so I usually spend time adding words to the hyphenation list.

    But still, in any longer text there's usually a couple of paragraphs that just won't set right, I'm curious about your tricks or methods for dealing with them.

  • TeX typesetting @lemmy.sdfeu.org
    quat @lemmy.sdfeu.org

    Quantum spaces: Designing pages on grids

    This is a rather interesting presentation by Jean-Luc Doumont about placing content on a grid, or a subset of the grid. He's kind of taking this idea to the extreme.

  • TeX typesetting @lemmy.sdfeu.org
    quat @lemmy.sdfeu.org

    A macro to visualize boxes

    There's this guy called Stephan V. Bechtolsheim who wrote a series of books on TeX called "TeX in Practice". He's really good at the finer details of, well, everything.

    In one of the books, he makes a macro to visualize boxes. It's built up over many pages and chapters with lots of small macros as building blocks. Because he's reusing these macros in different places, it makes a lot of sense.

    However, when I wanted to use the box visualizing macro, I found that I had to look up and copy a lot of code to make it work. This was no fun, so I re-wrote it in a "flatter" way where it's just regular plain old macros.

    I ended up with this:

     undefined
        
    \newdimen\linethickness \linethickness=0.4pt
    
    \def\boxlines #1{%
        \hbox{%
            % Save original (argument) box
            \setbox0 = #1%
            % Place bullet at baseline and vertical align of the box
            \setbox1 = \hbox{\hskip -2.5pt \lower 2.5pt \hbox{$\circ$}}%
            \ht1=0pt \dp1=0pt \wd1=0pt
            \box1
            % Place a dashed line 
      
  • TeX typesetting @lemmy.sdfeu.org
    quat @lemmy.sdfeu.org

    Golden canon of page construction

    Jan Tschichold and Raul Rosariva independently researched the layout of medieval books, and each came up with a method of construction. Rosarivas version (to the right) lends itself very well to a programmatic approach. We could implement it (in luaTeX) in a few lines like this:

     undefined
        
    % Page size (proportions 2:3)
    \pagewidth=150mm	
    \pageheight=225mm
    
    % Undo 1 inch origin (personal preference)
    \pdfvariable horigin 0pt
    \pdfvariable vorigin 0pt
    
    % Inner margin
    \hoffset=\pagewidth
    \divide\hoffset by9
    
    % Top margin
    \voffset=\pageheight
    \divide\voffset by9
    
    % Type area width
    \hsize=\pagewidth
    \divide\hsize by9
    \multiply\hsize by6
    
    % Type area height
    \vsize=\pageheight
    \divide\vsize by9
    \multiply\vsize by6
    
      

    This is all well and good if we have vertically stretchable material on every page. But... if we want to do grid typesetting, we will quickly run into "Underfull \vbox (badness 10000)".

    Let's say we've se