<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Knowledge Bits - Software</title><link href="https://jwodder.github.io/kbits/" rel="alternate"></link><link href="https://jwodder.github.io/kbits/feeds/category.software.atom.xml" rel="self"></link><id>https://jwodder.github.io/kbits/</id><updated>2026-05-22T00:00:00-04:00</updated><subtitle>References I wish I'd already found</subtitle><entry><title>Retrieving Logs for a Single Service Run from systemd</title><link href="https://jwodder.github.io/kbits/posts/systemd-logs/" rel="alternate"></link><published>2026-05-10T00:00:00-04:00</published><updated>2026-05-10T00:00:00-04:00</updated><author><name>John T. Wodder II</name></author><id>tag:jwodder.github.io,2026-05-10:/kbits/posts/systemd-logs/</id><summary type="html">&lt;p class="first last"&gt;How to get the command output for a single run of a systemd service from
the systemd journal&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;a class="reference external" href="https://systemd.io"&gt;systemd&lt;/a&gt; is the init system and service manager (and a
bunch of other things) used by many major Linux distributions.  As a service
manager, it provides the ability to run programs (called &lt;em&gt;services&lt;/em&gt;) in the
background with features like restarting failed programs or running programs on
a schedule.  By default (i.e., unless a service’s unit file says to send it
somewhere else), the output from these programs is stored in a &lt;a class="reference external" href="https://www.freedesktop.org/software/systemd/man/latest/systemd-journald.service.html"&gt;journal&lt;/a&gt; that
can be viewed with the &lt;a class="reference external" href="https://www.freedesktop.org/software/systemd/man/latest/journalctl.html"&gt;&lt;tt class="docutils literal"&gt;journalctl(1)&lt;/tt&gt;&lt;/a&gt; command.  However, basic &lt;tt class="docutils literal"&gt;journalctl(1)&lt;/tt&gt;
invocations have the potential to swamp you with logs; sometimes you just want
to see the output from a single run of a service or see a history of when a
service was started &amp;amp; stopped.  Here’s how you do that.&lt;/p&gt;
&lt;p&gt;This article is based on systemd 255 on Ubuntu Noble 24.04.  There may be some
corner cases I have missed that make what I say here not 100% accurate.&lt;/p&gt;
&lt;div class="section" id="basic-journalctl-1-usage"&gt;
&lt;h2&gt;Basic &lt;tt class="docutils literal"&gt;journalctl(1)&lt;/tt&gt; Usage&lt;/h2&gt;
&lt;p&gt;By default, a given user only has permission to read journal entries for their
own per-user systemd service manager.  In order to read the system journal or
other users’ journals, you must be &lt;tt class="docutils literal"&gt;root&lt;/tt&gt; (possibly via &lt;tt class="docutils literal"&gt;sudo&lt;/tt&gt;) or belong
to the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;systemd-journal&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;adm&lt;/tt&gt;, or &lt;tt class="docutils literal"&gt;wheel&lt;/tt&gt; group.&lt;/p&gt;
&lt;div class="admonition important"&gt;
&lt;p class="first admonition-title"&gt;Important&lt;/p&gt;
&lt;p class="last"&gt;Journal entries do not last forever; you only have so much disk space,
after all.  Depending on configuration, the journal service will delete old
entries if they reach a certain age or if the total size of the journal
reaches a certain limit.  You therefore might not be able to retrieve
information from the journal about things that happened too long ago.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can get a basic view of all the journal entries for a service by running
&lt;tt class="docutils literal"&gt;journalctl &lt;span class="pre"&gt;-u&lt;/span&gt; $service&lt;/tt&gt;, where &lt;tt class="docutils literal"&gt;$service&lt;/tt&gt; is the name of the service with
or without the “&lt;tt class="docutils literal"&gt;.service&lt;/tt&gt;” suffix.  Add the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--user&lt;/span&gt;&lt;/tt&gt; option if the service
belongs to your per-user manager.  The entries shown can be limited with the
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-n&lt;/span&gt;&lt;/tt&gt;/&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--lines&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--since&lt;/span&gt;&lt;/tt&gt;, and &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--until&lt;/span&gt;&lt;/tt&gt; options, among others; see the
&lt;a class="reference external" href="https://www.freedesktop.org/software/systemd/man/latest/journalctl.html"&gt;&lt;tt class="docutils literal"&gt;journalctl(1)&lt;/tt&gt;&lt;/a&gt; manpage for more information.&lt;/p&gt;
&lt;p&gt;By default, the output from &lt;tt class="docutils literal"&gt;journalctl&lt;/tt&gt; is a chronological sequence of both
systemd-generated messages (things like “Starting myservice.service”) and
service-generated messages (such as standard output from the service commands).
Each line consists of a timestamp, a hostname, a command name, a PID, and the
actual message.  The &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-o&lt;/span&gt;&lt;/tt&gt;/&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--output&lt;/span&gt;&lt;/tt&gt; option can be used to adjust the
output format, though most formats only differ in how the timestamp is
displayed.&lt;/p&gt;
&lt;p&gt;Internally, each entry in systemd’s journal consists of a number of key-value
pairs called &lt;em&gt;fields&lt;/em&gt; that include data on the logged message, when it was
emitted, and where it came from.  Most of the fields are documented in
&lt;a class="reference external" href="https://www.freedesktop.org/software/systemd/man/latest/systemd.journal-fields.html"&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;systemd.journal-fields(7)&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;, and you can output all fields of journal entries by
passing &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-o&lt;/span&gt; json&lt;/tt&gt; (or &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-o&lt;/span&gt; &lt;span class="pre"&gt;json-pretty&lt;/span&gt;&lt;/tt&gt; or another supported JSON format) or
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-o&lt;/span&gt; verbose&lt;/tt&gt; to &lt;tt class="docutils literal"&gt;journalctl&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;journalctl&lt;/tt&gt; entries can be filtered based on field values by passing the
command one or more &lt;em&gt;match arguments&lt;/em&gt; of the form &lt;tt class="docutils literal"&gt;FIELDNAME=VALUE&lt;/tt&gt;.  Note
that only exact string matches on values are supported; you cannot ask
&lt;tt class="docutils literal"&gt;journalctl&lt;/tt&gt; to filter, say, by a regex or by whether a field is set/unset;
for that, postprocessing the output with &lt;a class="reference external" href="https://jqlang.org"&gt;&lt;tt class="docutils literal"&gt;jq(1)&lt;/tt&gt;&lt;/a&gt; or another program is necessary.
Multiple match arguments for the same field name are ORed together, while match
arguments for different fields are ANDed.  Using &lt;tt class="docutils literal"&gt;+&lt;/tt&gt; as an argument causes
the preceding match arguments to be ORed as a group against the following match
arguments.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="systemd-vs-service-entries"&gt;
&lt;h2&gt;Systemd vs. Service Entries&lt;/h2&gt;
&lt;p&gt;When working with a service’s journal logs, there are two main types of entries
that we usually want to discern between: entries emitted by systemd itself
about the service — usually messages of the form “Starting myservice.service”,
“Stopped myservice.service”, etc. — and entries that contain output from the
service’s actual command(s).&lt;/p&gt;
&lt;p&gt;Entries from systemd itself about a service are distinguished by having the
&lt;tt class="docutils literal"&gt;INVOCATION_ID&lt;/tt&gt; field (or &lt;tt class="docutils literal"&gt;USER_INVOCATION_ID&lt;/tt&gt; for user services) set but
not &lt;tt class="docutils literal"&gt;_SYSTEMD_INVOCATION_ID&lt;/tt&gt;; the &lt;tt class="docutils literal"&gt;SYSLOG_IDENTIFIER&lt;/tt&gt; field will also have
a value of “&lt;tt class="docutils literal"&gt;systemd&lt;/tt&gt;”.  The &lt;tt class="docutils literal"&gt;UNIT&lt;/tt&gt; field (or &lt;tt class="docutils literal"&gt;USER_UNIT&lt;/tt&gt; for user
services) will also be set to the name of the service in question (including
template arguments and the “&lt;tt class="docutils literal"&gt;.service&lt;/tt&gt;” suffix).&lt;/p&gt;
&lt;div class="admonition caution"&gt;
&lt;p class="first admonition-title"&gt;Caution!&lt;/p&gt;
&lt;p class="last"&gt;Field names without leading underscores are not “trusted” journal fields,
and thus any program that writes directly to the journal can create an
entry with &lt;tt class="docutils literal"&gt;INVOCATION_ID&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;SYSLOG_IDENTIFIER&lt;/tt&gt;, or &lt;tt class="docutils literal"&gt;UNIT&lt;/tt&gt; set to
whatever it wants.  In order to exclude any potential deceptive entries
when using &lt;tt class="docutils literal"&gt;journalctl&lt;/tt&gt; to filter by one or more of these fields, include
&lt;tt class="docutils literal"&gt;_PID=1&lt;/tt&gt; as a match argument so that you only see entries from
&lt;tt class="docutils literal"&gt;systemd&lt;/tt&gt; itself.  Note that this only works when querying the system
manager; for user managers, there does not seem to be a foolproof way to
say “only show entries generated by the manager.”&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Entries for actual output from a service’s commands (including child commands)
are distinguished by having the &lt;tt class="docutils literal"&gt;_SYSTEMD_INVOCATION_ID&lt;/tt&gt; field set, but not
&lt;tt class="docutils literal"&gt;INVOCATION_ID&lt;/tt&gt; or &lt;tt class="docutils literal"&gt;USER_INVOCATION_ID&lt;/tt&gt;.  The &lt;tt class="docutils literal"&gt;_SYSTEMD_UNIT&lt;/tt&gt; field (or
&lt;tt class="docutils literal"&gt;_SYSTEMD_USER_UNIT&lt;/tt&gt; for user services) will also be set to the name of the
service in question (including template arguments and the “&lt;tt class="docutils literal"&gt;.service&lt;/tt&gt;”
suffix).&lt;/p&gt;
&lt;p&gt;Note that the latter kind of entries don’t just cover the service’s stdout &amp;amp;
stderr; if the service command logged anything via syslog or wrote to the
journal directly, that’s in here, too.  You can separate out these sources by
filtering on the &lt;tt class="docutils literal"&gt;_TRANSPORT&lt;/tt&gt; field, which has a value of “&lt;tt class="docutils literal"&gt;stdout&lt;/tt&gt;” for
the command’s standard output &amp;amp; standard error (and for input to
&lt;a class="reference external" href="https://www.freedesktop.org/software/systemd/man/latest/systemd-cat.html"&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;systemd-cat(1)&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;), “&lt;tt class="docutils literal"&gt;syslog&lt;/tt&gt;” for syslog messages, and “&lt;tt class="docutils literal"&gt;journal&lt;/tt&gt;” for
messages written directly to the journal with the &lt;a class="reference external" href="https://www.freedesktop.org/software/systemd/man/latest/sd_journal_print.html"&gt;&lt;tt class="docutils literal"&gt;sd_journal_print(3)&lt;/tt&gt;&lt;/a&gt; APIs.&lt;/p&gt;
&lt;p&gt;You may be wondering about the value of the &lt;tt class="docutils literal"&gt;SYSLOG_IDENTIFIER&lt;/tt&gt; mentioned
above when it comes to command output entries.  As far as I can determine, when
&lt;tt class="docutils literal"&gt;_TRANSPORT&lt;/tt&gt; is “&lt;tt class="docutils literal"&gt;stdout&lt;/tt&gt;” or “&lt;tt class="docutils literal"&gt;journal&lt;/tt&gt;”, &lt;tt class="docutils literal"&gt;SYSLOG_IDENTIFIER&lt;/tt&gt; is
usually the filename of the executable that produced the message, except for
messages produced with &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;systemd-cat&lt;/span&gt;&lt;/tt&gt;, which use the identifier specified on
the command line with &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--identifier&lt;/span&gt;&lt;/tt&gt;, leaving the field unset if the option
is not given.  For &lt;tt class="docutils literal"&gt;_TRANSPORT=syslog&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;SYSLOG_IDENTIFIER&lt;/tt&gt; is the program
name by default, but programs that write to syslog are free to use any string
they want as their identifier.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="invocation-ids"&gt;
&lt;h2&gt;Invocation IDs&lt;/h2&gt;
&lt;p&gt;As you may have noticed above, journal entries related to a service run all
have an invocation ID associated with them.  Each invocation ID is a random
32-character hexadecimal string that identifies a specific &lt;em&gt;runtime cycle&lt;/em&gt; of a
service (the period between when the service changes from “inactive” to
“active”/”activating” and when it becomes inactive again).  An invocation ID is
the key information needed to get the logs for a single service run from
&lt;tt class="docutils literal"&gt;journalctl&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;If you want to view the logs for the most-recently started run of a service,
begin by getting that run’s invocation ID via:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
systemctl show --no-pager -P InvocationID $service
&lt;/pre&gt;
&lt;p&gt;Replace &lt;tt class="docutils literal"&gt;$service&lt;/tt&gt; with the name of the service in question (with or without
the “&lt;tt class="docutils literal"&gt;.service&lt;/tt&gt;” suffix).  If querying a user session unit, add &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--user&lt;/span&gt;&lt;/tt&gt; to
the command.  If the service has stopped and not been restarted, this command
will nevertheless output the invocation ID for the most recent (stopped) run.
If the given service does not exist or was never started, the command will
output a blank line.&lt;/p&gt;
&lt;p&gt;If the run you want logs for is not the most recent, you’ll need to determine
the run’s invocation ID by looking back through the journal for the service.
If you just know the approximate time at which the desired run occurred, you
can browse the “Starting $service.service” and “Stopped $service.service”
systemd messages with their timestamps &amp;amp; corresponding invocation IDs by using
&lt;a class="reference external" href="https://jqlang.org"&gt;&lt;tt class="docutils literal"&gt;jq(1)&lt;/tt&gt;&lt;/a&gt; and the following shell command:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
journalctl -o json -t systemd -u $service | jq -r '&amp;quot;[\(.__REALTIME_TIMESTAMP|tonumber / 1000000 | todate)] [\(.INVOCATION_ID)] \(.MESSAGE)&amp;quot;'
&lt;/pre&gt;
&lt;p&gt;Replace &lt;tt class="docutils literal"&gt;$service&lt;/tt&gt; with the name of the service in question (with or without
the “&lt;tt class="docutils literal"&gt;.service&lt;/tt&gt;” suffix).  If querying a user session unit, add &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--user&lt;/span&gt;&lt;/tt&gt; to
the &lt;tt class="docutils literal"&gt;journalctl&lt;/tt&gt; command and change &lt;tt class="docutils literal"&gt;.INVOCATION_ID&lt;/tt&gt; in the &lt;tt class="docutils literal"&gt;jq&lt;/tt&gt; command
to &lt;tt class="docutils literal"&gt;.USER_INVOCATION_ID&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;This will give you output like the following, letting you map timestamp ranges
to invocation IDs:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
[2026-04-22T13:41:35Z] [439e459b1db44a97974eae5c133f4543] Starting apache2.service - The Apache HTTP Server...
[2026-04-22T13:41:36Z] [439e459b1db44a97974eae5c133f4543] Started apache2.service - The Apache HTTP Server.
[2026-04-23T00:00:00Z] [439e459b1db44a97974eae5c133f4543] Reloading apache2.service - The Apache HTTP Server...
[2026-04-23T00:00:00Z] [439e459b1db44a97974eae5c133f4543] Reloaded apache2.service - The Apache HTTP Server.
[2026-04-24T00:00:00Z] [439e459b1db44a97974eae5c133f4543] Reloading apache2.service - The Apache HTTP Server...
[2026-04-24T00:00:00Z] [439e459b1db44a97974eae5c133f4543] Reloaded apache2.service - The Apache HTTP Server.
[2026-04-26T00:00:00Z] [439e459b1db44a97974eae5c133f4543] Reloading apache2.service - The Apache HTTP Server...
[2026-04-26T00:00:01Z] [439e459b1db44a97974eae5c133f4543] Reloaded apache2.service - The Apache HTTP Server.
[2026-04-27T00:00:01Z] [439e459b1db44a97974eae5c133f4543] Reloading apache2.service - The Apache HTTP Server...
[2026-04-27T00:00:01Z] [439e459b1db44a97974eae5c133f4543] Reloaded apache2.service - The Apache HTTP Server.
[2026-05-07T16:19:39Z] [439e459b1db44a97974eae5c133f4543] Stopping apache2.service - The Apache HTTP Server...
[2026-05-07T16:19:40Z] [439e459b1db44a97974eae5c133f4543] apache2.service: Deactivated successfully.
[2026-05-07T16:19:40Z] [439e459b1db44a97974eae5c133f4543] Stopped apache2.service - The Apache HTTP Server.
[2026-05-07T16:19:40Z] [439e459b1db44a97974eae5c133f4543] apache2.service: Consumed 8min 45.667s CPU time, 111.8M memory peak, 22.5M memory swap peak.
[2026-05-07T16:19:40Z] [c80c7d5e0453447ea57bf833b3ead2cf] Starting apache2.service - The Apache HTTP Server...
[2026-05-07T16:19:40Z] [c80c7d5e0453447ea57bf833b3ead2cf] Started apache2.service - The Apache HTTP Server.
[2026-05-08T00:00:00Z] [c80c7d5e0453447ea57bf833b3ead2cf] Reloading apache2.service - The Apache HTTP Server...
[2026-05-08T00:00:01Z] [c80c7d5e0453447ea57bf833b3ead2cf] Reloaded apache2.service - The Apache HTTP Server.
[2026-05-09T00:00:01Z] [c80c7d5e0453447ea57bf833b3ead2cf] Reloading apache2.service - The Apache HTTP Server...
[2026-05-09T00:00:01Z] [c80c7d5e0453447ea57bf833b3ead2cf] Reloaded apache2.service - The Apache HTTP Server.
[2026-05-10T00:00:00Z] [c80c7d5e0453447ea57bf833b3ead2cf] Reloading apache2.service - The Apache HTTP Server...
[2026-05-10T00:00:00Z] [c80c7d5e0453447ea57bf833b3ead2cf] Reloaded apache2.service - The Apache HTTP Server.
&lt;/pre&gt;
&lt;p&gt;If you don’t know the run’s timestamp but you can recognize the target run from
the command output, you can view all log messages prefixed with their
invocation IDs like so:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
journalctl -o json -u $service | jq -r '&amp;quot;[\(.INVOCATION_ID // ._SYSTEMD_INVOCATION_ID)] \(.MESSAGE)&amp;quot;'
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="getting-logs-for-an-invocation-id"&gt;
&lt;h2&gt;Getting Logs for an Invocation ID&lt;/h2&gt;
&lt;p&gt;Once you have the invocation ID for the service run you want to view logs for,
you can get the service’s output with:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
journalctl _SYSTEMD_INVOCATION_ID=$id
&lt;/pre&gt;
&lt;p&gt;where &lt;tt class="docutils literal"&gt;$id&lt;/tt&gt; is replaced by the invocation ID.  Note that there is no need to
specify the service name, nor even to specify &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--user&lt;/span&gt;&lt;/tt&gt; for user session
units.&lt;/p&gt;
&lt;p&gt;Note that the output from this command will include fields like timestamp,
hostname, command name, and PID in each line.  If you just want only the actual
output from the service with no “decorations,” add &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-o&lt;/span&gt; cat&lt;/tt&gt; to the command.
If you want custom formatting, your best bet is to output all the journal
fields with &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-o&lt;/span&gt; json&lt;/tt&gt; and process the entries with &lt;tt class="docutils literal"&gt;jq&lt;/tt&gt; or another program.&lt;/p&gt;
&lt;p&gt;If you also want to include systemd’s “Starting”, “Stopped”, etc. messages in
the output (say, in order to see the command’s exit status), change the match
arguments like so:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
journalctl INVOCATION_ID=$id + _SYSTEMD_INVOCATION_ID=$id
&lt;/pre&gt;
&lt;p&gt;If querying a user session unit, change &lt;tt class="docutils literal"&gt;INVOCATION_ID&lt;/tt&gt; to
&lt;tt class="docutils literal"&gt;USER_INVOCATION_ID&lt;/tt&gt;.&lt;/p&gt;
&lt;/div&gt;
</content><category term="Software"></category><category term="systemd"></category><category term="UNIX"></category></entry><entry><title>The BitTorrent Encryption Protocol</title><link href="https://jwodder.github.io/kbits/posts/bt-encrypt/" rel="alternate"></link><published>2023-10-19T00:00:00-04:00</published><updated>2023-12-03T00:00:00-05:00</updated><author><name>John T. Wodder II</name></author><id>tag:jwodder.github.io,2023-10-19:/kbits/posts/bt-encrypt/</id><summary type="html">&lt;p class="first last"&gt;The &lt;a class="reference external" href="https://en.wikipedia.org/wiki/BitTorrent_protocol_encryption"&gt;encryption protocol&lt;/a&gt; used by the &lt;a class="reference external" href="https://en.wikipedia.org/wiki/BitTorrent"&gt;BitTorrent&lt;/a&gt; peer-to-peer
file-sharing protocol — known variously as Message Stream Encryption (MSE),
Protocol Encryption (PE), or MSE/PE, among other names — is what keeps you
secure while you download massive amounts of … Linux ISOs.  Here’s how it
works.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;The &lt;a class="reference external" href="https://en.wikipedia.org/wiki/BitTorrent_protocol_encryption"&gt;encryption protocol&lt;/a&gt; used by the &lt;a class="reference external" href="https://en.wikipedia.org/wiki/BitTorrent"&gt;BitTorrent&lt;/a&gt; peer-to-peer file-sharing
protocol — known variously as Message Stream Encryption (MSE), Protocol
Encryption (PE), or MSE/PE, among other names — is what keeps you secure while
you download massive amounts of … Linux ISOs.  While some (including the
creator of BitTorrent) have been critical of the protocol, comparing it to mere
“obfuscation,” it remains highly popular among users distributing perfectly
legitimate files over the internet that ISPs shouldn’t concern themselves over.&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;de facto&lt;/em&gt; specification for the protocol appears to be
&amp;lt;&lt;a class="reference external" href="https://wiki.vuze.com/w/Message_Stream_Encryption"&gt;https://wiki.vuze.com/w/Message_Stream_Encryption&lt;/a&gt;&amp;gt;, but the page has been down
whenever I’ve checked recently, and the actual content is not optimally
presented.  Thus, I’ve written up everything I’ve been able to determine about
MSE/PE here.&lt;/p&gt;
&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title"&gt;Contents&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#overview" id="toc-entry-1"&gt;Overview&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#definitions" id="toc-entry-2"&gt;Definitions&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#client-s-handshake" id="toc-entry-3"&gt;Client’s Handshake&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#server-s-handshake" id="toc-entry-4"&gt;Server’s Handshake&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#after-the-handshake" id="toc-entry-5"&gt;After the Handshake&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#bittorrent-specific-aspects" id="toc-entry-6"&gt;BitTorrent-Specific Aspects&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#detecting-encryption" id="toc-entry-7"&gt;Detecting Encryption&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#broadcasting-encryption-support" id="toc-entry-8"&gt;Broadcasting Encryption Support&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#references" id="toc-entry-9"&gt;References&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="overview"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Overview&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;An MSE/PE connection begins with the client and server performing a
&lt;a class="reference external" href="https://en.wikipedia.org/wiki/Diffie–Hellman_key_exchange"&gt;Diffie–Hellman key exchange&lt;/a&gt; handshake, in which each party generates a
private key with corresponding public key, the public keys are exchanged, and
then — by the power of mathematics — both parties independently calculate the
same number (the &lt;em&gt;shared secret&lt;/em&gt;), which remains unknown to eavesdroppers.
Each party then uses the shared secret to initialize two &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Keystream"&gt;keystreams&lt;/a&gt;: infinite
generators of pseudo-random bytes calculated from an initial value; the bytes
from one keystream are then used to encrypt &amp;amp; decrypt data sent from the client
to the server, and the other keystream is used for data sent from the server to
the client.&lt;/p&gt;
&lt;p&gt;After the handshake, the parties transmit their data, which is encrypted using
a method negotiated during the handshake; the only defined options are to keep
using the keystreams or to stop using encryption entirely.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="definitions"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Definitions&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;MSE/PE encryption uses the following constants and functions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;P&lt;/tt&gt; is the following 96-byte (768-bit) prime, here rendered in
hexadecimal:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
ffffffffffffffff c90fdaa22168c234  c4c6628b80dc1cd1 29024e088a67cc74
020bbea63b139b22 514a08798e3404dd  ef9519b3cd3a431b 302b0a6df25f1437
4fe1356d6d51c245 e485b576625e7ec6  f44c42e9a63a3621 0000000000090563
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;G&lt;/tt&gt; is 2 (a &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Primitive_root_modulo_n"&gt;primitive root&lt;/a&gt; &lt;em&gt;modulo&lt;/em&gt; &lt;tt class="docutils literal"&gt;P&lt;/tt&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;SKEY&lt;/tt&gt; is a shared key — a byte string with a value known or recognizable
by both parties.  For BitTorrent, this is the 20-byte info hash of the
torrent the connection is dedicated to.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;len(X)&lt;/tt&gt; is the length of the byte string &lt;tt class="docutils literal"&gt;X&lt;/tt&gt; as a two-byte big-endian
integer.  The length of &lt;tt class="docutils literal"&gt;X&lt;/tt&gt; cannot exceed 65535.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;HASH(X)&lt;/tt&gt; is the 20-byte SHA1 hash of the byte string &lt;tt class="docutils literal"&gt;X&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="client-s-handshake"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Client’s Handshake&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The peer initiating an MSE/PE connection performs its side of the handshake as
follows as soon as it opens the connection:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;The client generates a random integer &lt;tt class="docutils literal"&gt;Xa&lt;/tt&gt; to use as its private key for
this connection only.  &lt;tt class="docutils literal"&gt;Xa&lt;/tt&gt; must be at least 128 bits long; using more than
180 bits is not believed to add further security.  160 bits is recommended.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The client calculates its public key: &lt;tt class="docutils literal"&gt;Ya = pow(G, Xa) mod P&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The client sends packet 1: &lt;tt class="docutils literal"&gt;Ya&lt;/tt&gt; encoded as a 96-byte (768-bit) big-endian
integer, followed by a string of random bytes with a randomly-chosen length
from 0 to 512.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The client receives packet 2.  Because the length of this packet is not known
by the client and there is no means for indicating the end of the packet, the
client must identify the end of the packet by waiting for sufficient time
(the original spec says 30 seconds) for the entire packet to arrive.  If the
server sends fewer than 96 bytes in that time (For comparison, the
unencrypted BitTorrent handshake message is 68 bytes), or the server sends
more than 608 bytes, then the server is not performing a valid MSE/PE
handshake.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The client extracts &lt;tt class="docutils literal"&gt;Yb&lt;/tt&gt; from the first 96 bytes of packet 2 and computes
the Diffie-Hellman shared secret: &lt;tt class="docutils literal"&gt;S = pow(Yb, Xa) mod P&lt;/tt&gt;.  &lt;tt class="docutils literal"&gt;Xa&lt;/tt&gt; is then
securely discarded.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;When used as a byte string in later steps, &lt;tt class="docutils literal"&gt;S&lt;/tt&gt; is encoded as a 96-byte
(768-bit) big-endian integer.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The client initializes an outgoing &lt;a class="reference external" href="https://en.wikipedia.org/wiki/RC4"&gt;RC4&lt;/a&gt;
keystream from the key &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;HASH(&amp;quot;keyA&amp;quot;&lt;/span&gt; + S + SKEY)&lt;/tt&gt; and an incoming RC4
keystream from the key &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;HASH(&amp;quot;keyB&amp;quot;&lt;/span&gt; + S + SKEY)&lt;/tt&gt;.  The first 1024 bytes
output by each keystream are discarded.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The client sends packet 3, constructed as follows:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
HASH(&amp;quot;req1&amp;quot; + S)
+ (HASH(&amp;quot;req2&amp;quot; + SKEY) XOR HASH(&amp;quot;req3&amp;quot; + S))
+ RC4(VC + crypto_provide + len(PadC) + PadC + len(IA) + IA)
&lt;/pre&gt;
&lt;p&gt;where:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;RC4(X)&lt;/tt&gt; encrypts the byte string &lt;tt class="docutils literal"&gt;X&lt;/tt&gt; by XORing it with bytes produced
by the outgoing RC4 keystream.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;VC&lt;/tt&gt; is a verification constant of eight zero-valued bytes that is used
to verify whether the other party knows &lt;tt class="docutils literal"&gt;S&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;SKEY&lt;/tt&gt; and thus defeat
replay attacks of the &lt;tt class="docutils literal"&gt;SKEY&lt;/tt&gt; hash.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;crypto_provide&lt;/tt&gt; is a 32-bit big-endian integer in which individual bits
are set to indicate the encryption methods supported by the client.  The
defined methods are plain text (bit 0x01) and RC4 (bit 0x02).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;PadC&lt;/tt&gt; is arbitrary data with a length of 0 to 512 bytes, reserved for
extending the crypto handshake in future versions.  Current implementations
may choose to set it to the empty string.  For padding-only usage in the
current version, the bytes should be zeroed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;IA&lt;/tt&gt; is the initial (post-handshake) data that the client wishes to send.
It may be 0 bytes long, and it cannot be more than 65535 bytes long.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The client receives &amp;amp; verifies packet 4:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;The first eight bytes are received and decrypted by XORing them with bytes
from the incoming RC4 keystream.  If the resulting bytes are not all zero,
the handshake is invalid.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The next four bytes are received and decrypted in the same manner to obtain
&lt;tt class="docutils literal"&gt;crypto_select&lt;/tt&gt;, a big-endian integer in which a bit corresponding to one
of the methods given in &lt;tt class="docutils literal"&gt;crypto_provide&lt;/tt&gt; has been set in order to
indicate which encryption method will be used after the handshake.  If
&lt;tt class="docutils literal"&gt;crypto_select&lt;/tt&gt; does not have exactly one bit set, or if the set bit does
not correspond to one of the methods in &lt;tt class="docutils literal"&gt;crypto_provide&lt;/tt&gt;, the handshake
is invalid.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The next two bytes are received and decrypted to obtain &lt;tt class="docutils literal"&gt;len(PadD)&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The next &lt;tt class="docutils literal"&gt;len(PadD)&lt;/tt&gt; bytes are received and decrypted to obtain &lt;tt class="docutils literal"&gt;PadD&lt;/tt&gt;.
Note that, although the result of the decryption is unused, the decryption
must still be performed in order to keep the incoming keystream in sync
with the server’s outgoing keystream.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="server-s-handshake"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Server’s Handshake&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The peer receiving an MSE/PE connection performs its side of the handshake as
follows as soon as it accepts the connection:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;The server generates a private key &lt;tt class="docutils literal"&gt;Xb&lt;/tt&gt; following the same rules as for the
client’s private key.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The server calculates its public key: &lt;tt class="docutils literal"&gt;Yb = pow(G, Xb) mod P&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The server sends packet 2: &lt;tt class="docutils literal"&gt;Yb&lt;/tt&gt; encoded as a 96-byte (768-bit) big-endian
integer, followed by a string of random bytes with a randomly-chosen length
from 0 to 512.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The server receives packet 1.  As with the client’s receipt of packet 2, the
server must determine the end of packet 1 by waiting for sufficient time (the
original spec says 30 seconds) for the entire packet to arrive.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The server extracts &lt;tt class="docutils literal"&gt;Ya&lt;/tt&gt; from the first 96 bytes of packet 1 and computes
the Diffie-Hellman shared secret: &lt;tt class="docutils literal"&gt;S = pow(Ya, Xb) mod P&lt;/tt&gt; (This is equal to
the &lt;tt class="docutils literal"&gt;S&lt;/tt&gt; computed by the client).  &lt;tt class="docutils literal"&gt;Xb&lt;/tt&gt; is then securely discarded.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;When used as a byte string in later steps, &lt;tt class="docutils literal"&gt;S&lt;/tt&gt; is encoded as a 96-byte
(768-bit) big-endian integer.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The server receives &amp;amp; verifies packet 3:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;The first 20 bytes must equal &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;HASH(&amp;quot;req1&amp;quot;&lt;/span&gt; + S)&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The next 20 bytes are received and XORed with &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;HASH(&amp;quot;req3&amp;quot;&lt;/span&gt; + S)&lt;/tt&gt; to
obtain &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;HASH(&amp;quot;req2&amp;quot;&lt;/span&gt; + SKEY)&lt;/tt&gt;.  The server then identifies &lt;tt class="docutils literal"&gt;SKEY&lt;/tt&gt; by
comparing this hash against &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;HASH(&amp;quot;req2&amp;quot;&lt;/span&gt; + K)&lt;/tt&gt; for all known/accepted
shared keys &lt;tt class="docutils literal"&gt;K&lt;/tt&gt;.  (For BitTorrent, this means comparing against
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;HASH(&amp;quot;req2&amp;quot;&lt;/span&gt; + info_hash)&lt;/tt&gt; for all info hashes of torrents managed by the
server.)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The server initializes an outgoing RC4 keystream from the key &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;HASH(&amp;quot;keyB&amp;quot;&lt;/span&gt;
+ S + SKEY)&lt;/tt&gt; and an incoming RC4 keystream from the key &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;HASH(&amp;quot;keyA&amp;quot;&lt;/span&gt; + S
+ SKEY)&lt;/tt&gt;.  (Note that this is the reverse of the client.)  The first 1024
bytes output by each keystream are discarded.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The next eight bytes are received and decrypted by XORing them with bytes
from the incoming RC4 keystream.  If the resulting bytes are not all zero,
the handshake is invalid.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The next four bytes are received and decrypted in the same manner to obtain
&lt;tt class="docutils literal"&gt;crypto_provide&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The next two bytes are received and decrypted to obtain &lt;tt class="docutils literal"&gt;len(PadC)&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The next &lt;tt class="docutils literal"&gt;len(PadC)&lt;/tt&gt; bytes are received and decrypted to obtain &lt;tt class="docutils literal"&gt;PadC&lt;/tt&gt;.
Note that, although the result of the decryption is unused, the decryption
must still be performed in order to keep the incoming keystream in sync
with the client’s outgoing keystream.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The next two bytes are received and decrypted to obtain &lt;tt class="docutils literal"&gt;len(IA)&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The next &lt;tt class="docutils literal"&gt;len(IA)&lt;/tt&gt; bytes are received and decrypted to obtain &lt;tt class="docutils literal"&gt;IA&lt;/tt&gt;, the
beginning of the actual data being transferred.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The server chooses one of the encryption methods given by &lt;tt class="docutils literal"&gt;crypto_provide&lt;/tt&gt;
to use for the rest of the connection.  Bits with unknown meanings are
ignored.  If &lt;tt class="docutils literal"&gt;crypto_provide&lt;/tt&gt; does not contain any encryption methods that
the server supports, the handshake fails.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The server sends packet 4: &lt;tt class="docutils literal"&gt;RC4(VC + crypto_select + len(PadD) + PadD)&lt;/tt&gt;,
where:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;RC4(X)&lt;/tt&gt; encrypts the byte string &lt;tt class="docutils literal"&gt;X&lt;/tt&gt; by XORing it with bytes produced
by the server’s outgoing RC4 keystream.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;VC&lt;/tt&gt; is eight zero-valued bytes, the same as in packet 3.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;crypto_select&lt;/tt&gt; is a 32-bit big-endian integer with one bit set to
indicate the encryption method chosen by the server.  The bits have the
same meanings as for &lt;tt class="docutils literal"&gt;crypto_provide&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;PadD&lt;/tt&gt; is arbitrary data with a length of 0 to 512 bytes, reserved for
extending the crypto handshake in future versions.  Current implementations
may choose to set them to 0-length.  For padding-only usage in the current
version, they should be zeroed.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="after-the-handshake"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;After the Handshake&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Once all of the above is carried out, the MSE/PE handshake is complete, and the
client &amp;amp; server transmit the data they came here to transmit, encrypted using
the selected encryption method.  If plain text was selected, further data is
sent &amp;amp; received as-is without encryption.  If RC4 was selected, sent &amp;amp; received
data will be encrypted using the sender’s outgoing RC4 keystream and decrypted
using the receiver’s incoming RC4 keystream; these are the same keystreams as
used during the handshake, i.e., they are not reinitialized.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="bittorrent-specific-aspects"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;BitTorrent-Specific Aspects&lt;/a&gt;&lt;/h2&gt;
&lt;div class="section" id="detecting-encryption"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Detecting Encryption&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;MSE/PE was introduced into a world where BitTorrent connections were already
being made without encryption, and many connections still aren’t encrypted, so
peers need a way to determine whether a fresh connection is encrypted or not.&lt;/p&gt;
&lt;p&gt;When a BitTorrent peer that supports MSE/PE receives an incoming connection, it
can determine whether an MSE/PE handshake is being performed by checking
whether the first 20 bytes received equal the BitTorrent handshake header
&lt;tt class="docutils literal"&gt;&amp;quot;\x13BitTorrent protocol&amp;quot;&lt;/tt&gt;; if the bytes match, the connection is (almost
certainly) not using MSE/PE, and the peer can choose to either continue the
connection unencrypted or else sever the connection.&lt;/p&gt;
&lt;p&gt;When a BitTorrent peer that supports MSE/PE makes an outgoing connection, it
has the following options, which it chooses among based on its configuration
and any broadcasts of encryption support it’s received (see below):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;The peer can attempt an MSE/PE handshake; if that fails, it abandons the
remote peer.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The peer can attempt an MSE/PE handshake; if that fails, it severs the
connection and tries to reconnect without using encryption.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The peer connects without using encryption.  If the remote peer sends a &lt;a class="reference external" href="https://www.bittorrent.org/beps/bep_0010.html"&gt;BEP
10&lt;/a&gt; extended handshake containing an &lt;tt class="docutils literal"&gt;e&lt;/tt&gt; value of &lt;tt class="docutils literal"&gt;1&lt;/tt&gt;, the local peer
severs the connection and reconnects using MSE/PE.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The peer connects without using encryption and does not use MSE/PE with the
remote peer.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="broadcasting-encryption-support"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Broadcasting Encryption Support&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;BitTorrent peers can broadcast their support of MSE/PE to other peers via HTTP
trackers and/or Peer Exchange.  (The UDP tracker protocol and DHT do not appear
to have any capabilities for broadcasting encryption support.)&lt;/p&gt;
&lt;p&gt;When a BitTorrent peer that supports MSE/PE makes an announcement to an HTTP
tracker, it can include one or more of the following URL query parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;supportcrypto=1&lt;/tt&gt; — Indicates that the peer can create &amp;amp; receive MSE/PE
connections&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;requirecrypto=1&lt;/tt&gt; — Indicates that the peer only creates &amp;amp; accepts MSE/PE
connections.  If the tracker supports this parameter, then this peer will not
be returned in responses to peers that do not set &lt;tt class="docutils literal"&gt;supportcrypto=1&lt;/tt&gt; or
&lt;tt class="docutils literal"&gt;requirecrypto=1&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;cryptoport=X&lt;/tt&gt; (used in combination with &lt;tt class="docutils literal"&gt;port=0&lt;/tt&gt; and
&lt;tt class="docutils literal"&gt;requirecrypto=1&lt;/tt&gt;) — If the tracker supports the &lt;tt class="docutils literal"&gt;cryptoport&lt;/tt&gt; parameter,
it will provide this peer’s port as &lt;tt class="docutils literal"&gt;X&lt;/tt&gt; in responses to other peers that
also support MSE/PE and will not provide this peer at all to peers that do
not support MSE/PE.  If the tracker does not support the &lt;tt class="docutils literal"&gt;cryptoport&lt;/tt&gt;
parameter, then this peer’s actual port will not be given out to any peers.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When &lt;tt class="docutils literal"&gt;supportcrypto=1&lt;/tt&gt; or &lt;tt class="docutils literal"&gt;requirecrypto=1&lt;/tt&gt; is set in an announcement to a
supporting HTTP tracker, the response will include a &lt;tt class="docutils literal"&gt;crypto_flags&lt;/tt&gt; field,
the value of which is a sequence of bytes, one for each peer in &lt;tt class="docutils literal"&gt;peers&lt;/tt&gt; in
order; a given byte will be &lt;tt class="docutils literal"&gt;1&lt;/tt&gt; if the peer requires MSE/PE and &lt;tt class="docutils literal"&gt;0&lt;/tt&gt;
otherwise.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;Preliminary searching on GitHub indicates that, when an HTTP tracker sends a
response with “&lt;tt class="docutils literal"&gt;peers&lt;/tt&gt;”, “&lt;tt class="docutils literal"&gt;peers6&lt;/tt&gt;”, and “&lt;tt class="docutils literal"&gt;crypto_flags&lt;/tt&gt;” fields, the
“&lt;tt class="docutils literal"&gt;crypto_flags&lt;/tt&gt;” only applies to the “&lt;tt class="docutils literal"&gt;peers&lt;/tt&gt;” field and not
“&lt;tt class="docutils literal"&gt;peers6&lt;/tt&gt;”, though I have yet to encounter a tracker that actually sends
“&lt;tt class="docutils literal"&gt;crypto_flags&lt;/tt&gt;” in the wild.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If a peer prefers MSE/PE connections to unencrypted, it can indicate this to
connecting peers by including an &lt;tt class="docutils literal"&gt;e&lt;/tt&gt; field with a value of &lt;tt class="docutils literal"&gt;1&lt;/tt&gt; in the &lt;a class="reference external" href="https://www.bittorrent.org/beps/bep_0010.html"&gt;BEP
10&lt;/a&gt; extended handshakes it sends.  This &lt;tt class="docutils literal"&gt;e&lt;/tt&gt; value will then be broadcast to
other peers using Peer Exchange (&lt;a class="reference external" href="https://www.bittorrent.org/beps/bep_0011.html"&gt;BEP 11&lt;/a&gt;).&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="references"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;References&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&amp;lt;&lt;a class="reference external" href="https://wiki.vuze.com/w/Message_Stream_Encryption"&gt;https://wiki.vuze.com/w/Message_Stream_Encryption&lt;/a&gt;&amp;gt; [&lt;a class="reference external" href="http://web.archive.org/web/20230405235517/https://wiki.vuze.com/w/Message_Stream_Encryption"&gt;Internet Archive Mirror&lt;/a&gt;]&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&amp;lt;&lt;a class="reference external" href="https://css.csail.mit.edu/6.858/2018/projects/bgu-kelvinlu.pdf"&gt;https://css.csail.mit.edu/6.858/2018/projects/bgu-kelvinlu.pdf&lt;/a&gt;&amp;gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&amp;lt;&lt;a class="reference external" href="https://atomashpolskiy.github.io/bt/encryption/"&gt;https://atomashpolskiy.github.io/bt/encryption/&lt;/a&gt;&amp;gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><category term="Software"></category><category term="BitTorrent"></category><category term="encryption"></category></entry><entry><title>Converting Lists to Simple Tables and Back with rs</title><link href="https://jwodder.github.io/kbits/posts/reshaping/" rel="alternate"></link><published>2023-05-03T00:00:00-04:00</published><updated>2023-05-03T00:00:00-04:00</updated><author><name>John T. Wodder II</name></author><id>tag:jwodder.github.io,2023-05-03:/kbits/posts/reshaping/</id><summary type="html">&lt;p class="first last"&gt;If you have a file that’s just a list of items, one item per line, and you
want to turn it into a simple table — one delimited just by whitespace
without any border characters — how would you do that?  Follow up question:
If you have a simple table, and you want to convert it into a list of
items, one per line, how would you do &lt;em&gt;that&lt;/em&gt;?  The answer to both questions
is: with the &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; command, and this article will show you how.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;If you have a file that’s just a list of items, one item per line, and you want
to turn it into a simple table — one delimited just by whitespace without any
border characters — how would you do that?  Follow up question: If you have a
simple table, and you want to convert it into a list of items, one per line,
how would you do &lt;em&gt;that&lt;/em&gt;?  The answer to both questions is: with the &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt;
command, and this article will show you how.&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; is a Unix command-line program for &lt;strong&gt;r&lt;/strong&gt;e&lt;strong&gt;s&lt;/strong&gt;haping arrays of
data.  Most Linux users can get it by installing the &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; package, and macOS
users will find it preinstalled.&lt;/p&gt;
&lt;div class="section" id="converting-a-list-of-lines-to-a-simple-table"&gt;
&lt;h2&gt;Converting a List of Lines to a Simple Table&lt;/h2&gt;
&lt;p&gt;When &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; is invoked without any options, it constructs a table from standard
input, treating each line as its own table entry, and fills in columns before
rows.  Thus, if we have the following file saved in &lt;tt class="docutils literal"&gt;lines.txt&lt;/tt&gt;:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Dapper Drake
Edgy Eft
Feisty Fawn
Gutsy Gibbon
Hardy Heron
Intrepid Ibex
Jaunty Jackalope
Karmic Koala
Lucid Lynx
Maverick Meerkat
Natty Narwhal
Oneiric Ocelot
Precise Pangolin
Quantal Quetzal
Raring Ringtail
Saucy Salamander
Trusty Tahr
Utopic Unicorn
Vivid Vervet
Wily Werewolf
Xenial Xerus
Yakkety Yak
Zesty Zapus
&lt;/pre&gt;
&lt;p&gt;Then running &lt;tt class="docutils literal"&gt;rs &amp;lt; lines.txt&lt;/tt&gt; will produce the following output:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Dapper Drake      Jaunty Jackalope  Precise Pangolin  Vivid Vervet
Edgy Eft          Karmic Koala      Quantal Quetzal   Wily Werewolf
Feisty Fawn       Lucid Lynx        Raring Ringtail   Xenial Xerus
Gutsy Gibbon      Maverick Meerkat  Saucy Salamander  Yakkety Yak
Hardy Heron       Natty Narwhal     Trusty Tahr       Zesty Zapus
Intrepid Ibex     Oneiric Ocelot    Utopic Unicorn
&lt;/pre&gt;
&lt;div class="admonition important"&gt;
&lt;p class="first admonition-title"&gt;Important&lt;/p&gt;
&lt;p class="last"&gt;When &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; is run without any arguments, it acts like it was given the
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-e&lt;/span&gt;&lt;/tt&gt; (Read one table entry from each line of input) and &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-t&lt;/span&gt;&lt;/tt&gt; (Fill in
columns before rows) options.  If you specify any arguments of your own,
then &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-e&lt;/span&gt;&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-t&lt;/span&gt;&lt;/tt&gt; will not be in effect unless you specify them
explicitly.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; automatically determines the number of table columns based on what will
fit in an 80-character line.  To change the line length to, say, 60 characters,
pass &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-w60&lt;/span&gt;&lt;/tt&gt; to the command (No space is allowed between the option and its
argument).  To ask for a specific number of table rows and let &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; figure
out the number of columns, supply the desired number of rows as an argument,
e.g., &lt;tt class="docutils literal"&gt;rs &lt;span class="pre"&gt;-e&lt;/span&gt; &lt;span class="pre"&gt;-t&lt;/span&gt; 8 &amp;lt; lines.txt&lt;/tt&gt;.  To ask for a specific number of table
columns instead, pass a &lt;tt class="docutils literal"&gt;0&lt;/tt&gt; argument (to tell &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; “Figure the number of
rows out yourself”) followed by the desired number of columns, e.g., &lt;tt class="docutils literal"&gt;rs &lt;span class="pre"&gt;-e&lt;/span&gt; &lt;span class="pre"&gt;-t&lt;/span&gt;
0 3 &amp;lt; lines.txt&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;By default, &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; will output every column at the same width; in the example
above, this results in the first column having more padding on the right than
is strictly necessary.  The &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-z&lt;/span&gt;&lt;/tt&gt; option will get rid of that padding; thus,
by running &lt;tt class="docutils literal"&gt;rs &lt;span class="pre"&gt;-e&lt;/span&gt; &lt;span class="pre"&gt;-t&lt;/span&gt; &lt;span class="pre"&gt;-z&lt;/span&gt; &amp;lt; lines.txt&lt;/tt&gt;, we get the following output:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Dapper Drake   Jaunty Jackalope  Precise Pangolin  Vivid Vervet
Edgy Eft       Karmic Koala      Quantal Quetzal   Wily Werewolf
Feisty Fawn    Lucid Lynx        Raring Ringtail   Xenial Xerus
Gutsy Gibbon   Maverick Meerkat  Saucy Salamander  Yakkety Yak
Hardy Heron    Natty Narwhal     Trusty Tahr       Zesty Zapus
Intrepid Ibex  Oneiric Ocelot    Utopic Unicorn
&lt;/pre&gt;
&lt;p&gt;One thing you might not have noticed about the output is that the last line,
having fewer columns than the others, ends in several spaces to make the end
line up with the start of the last column.  &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; doesn’t have an option to
disable this extra whitespace, but if you really want to get rid of it, you can
pipe the output through &lt;tt class="docutils literal"&gt;sed &lt;span class="pre"&gt;-e&lt;/span&gt; 's/ &lt;span class="pre"&gt;*$//'&lt;/span&gt;&lt;/tt&gt; to strip all trailing spaces.&lt;/p&gt;
&lt;p&gt;Lastly, if you want the rows of the table to be filled in before the columns,
invoke &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; with the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-e&lt;/span&gt;&lt;/tt&gt; option and no &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-t&lt;/span&gt;&lt;/tt&gt; option; thus, &lt;tt class="docutils literal"&gt;rs &lt;span class="pre"&gt;-e&lt;/span&gt; &amp;lt;
lines.txt&lt;/tt&gt; gives us:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Dapper Drake      Edgy Eft          Feisty Fawn       Gutsy Gibbon
Hardy Heron       Intrepid Ibex     Jaunty Jackalope  Karmic Koala
Lucid Lynx        Maverick Meerkat  Natty Narwhal     Oneiric Ocelot
Precise Pangolin  Quantal Quetzal   Raring Ringtail   Saucy Salamander
Trusty Tahr       Utopic Unicorn    Vivid Vervet      Wily Werewolf
Xenial Xerus      Yakkety Yak       Zesty Zapus
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="converting-a-simple-table-to-a-list-of-lines"&gt;
&lt;h2&gt;Converting a Simple Table to a List of Lines&lt;/h2&gt;
&lt;p&gt;Say we have the following text saved in &lt;tt class="docutils literal"&gt;table.txt&lt;/tt&gt;:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Dapper Drake      Jaunty Jackalope  Precise Pangolin  Vivid Vervet
Edgy Eft          Karmic Koala      Quantal Quetzal   Wily Werewolf
Feisty Fawn       Lucid Lynx        Raring Ringtail   Xenial Xerus
Gutsy Gibbon      Maverick Meerkat  Saucy Salamander  Yakkety Yak
Hardy Heron       Natty Narwhal     Trusty Tahr       Zesty Zapus
Intrepid Ibex     Oneiric Ocelot    Utopic Unicorn    Artful Aardvark
&lt;/pre&gt;
&lt;p&gt;and we want to convert this into a list of table entries, one per line, column
by column (i.e., we want &lt;tt class="docutils literal"&gt;Intrepid Ibex&lt;/tt&gt; to come before &lt;tt class="docutils literal"&gt;Jaunty Jackalope&lt;/tt&gt;
in the output).  Because the columns are separated by multiple spaces and the
table entries also contain spaces, we can’t use &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; by itself to accomplish
this.  Instead, we first use &lt;tt class="docutils literal"&gt;sed &lt;span class="pre"&gt;-e&lt;/span&gt; 's/ &lt;span class="pre"&gt;\{2,\}/\t/g'&lt;/span&gt;&lt;/tt&gt; to convert runs of two
or more spaces to tab characters, and then &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; can process the table using
tabs as the cell delimiter.&lt;/p&gt;
&lt;p&gt;Next, we have to pipe the output of &lt;tt class="docutils literal"&gt;sed&lt;/tt&gt; through two &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; invocations: the
first invocation transposes the table so that the second invocation will split
its entries apart in the correct order (For whatever reason, &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; can’t do
all this in a single invocation).  The full command line will look like this:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
sed -e 's/ \{2,\}/\t/g' table.txt | rs -c -C -T | rs -c 0 1
&lt;/pre&gt;
&lt;p&gt;(The &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-c&lt;/span&gt;&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-C&lt;/span&gt;&lt;/tt&gt; options tell &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; to use a tab as the input and output
column delimiters, respectively.)&lt;/p&gt;
&lt;p&gt;This works fine for the table above, but if the last column is short by two or
more columns, like so:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Dapper Drake      Jaunty Jackalope  Precise Pangolin  Vivid Vervet
Edgy Eft          Karmic Koala      Quantal Quetzal   Wily Werewolf
Feisty Fawn       Lucid Lynx        Raring Ringtail   Xenial Xerus
Gutsy Gibbon      Maverick Meerkat  Saucy Salamander  Yakkety Yak
Hardy Heron       Natty Narwhal     Trusty Tahr
Intrepid Ibex     Oneiric Ocelot    Utopic Unicorn
&lt;/pre&gt;
&lt;p&gt;then &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; will not do what we want by default.  When the &lt;tt class="docutils literal"&gt;rs &lt;span class="pre"&gt;-c&lt;/span&gt; &lt;span class="pre"&gt;-C&lt;/span&gt; &lt;span class="pre"&gt;-T&lt;/span&gt;&lt;/tt&gt; step
goes to transpose its input, it finds that a direct transposition would result
in the last two columns of the output being short, which &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; dislikes, and
so it decides to fix things by moving “Intrepid Ibex” (the next cell after
“Trusty Tahr”) to the cell below “Trusty Tahr” and right of “Yakkety Yak” in
the output, producing this (with tabs converted to aligned spaces to make it
easier to read):&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Dapper Drake      Edgy Eft          Feisty Fawn       Gutsy Gibbon      Hardy Heron       Oneiric Ocelot
Jaunty Jackalope  Karmic Koala      Lucid Lynx        Maverick Meerkat  Natty Narwhal     Utopic Unicorn
Precise Pangolin  Quantal Quetzal   Raring Ringtail   Saucy Salamander  Trusty Tahr
Vivid Vervet      Wily Werewolf     Xenial Xerus      Yakkety Yak       Intrepid Ibex
&lt;/pre&gt;
&lt;p&gt;and then when this table is flattened with &lt;tt class="docutils literal"&gt;rs &lt;span class="pre"&gt;-c&lt;/span&gt; 0 1&lt;/tt&gt;, the output will be in
the wrong order.&lt;/p&gt;
&lt;p&gt;We can tell &lt;tt class="docutils literal"&gt;rs&lt;/tt&gt; to not do this by passing the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-n&lt;/span&gt;&lt;/tt&gt; option to the &lt;tt class="docutils literal"&gt;rs &lt;span class="pre"&gt;-c&lt;/span&gt;
&lt;span class="pre"&gt;-C&lt;/span&gt; &lt;span class="pre"&gt;-T&lt;/span&gt;&lt;/tt&gt; command, which will make it output an all-blank entry below “Trusty”
and right of “Yakkety” in the output instead of moving “Intrepid.”  However,
this blank cell will result in the final &lt;tt class="docutils literal"&gt;rs &lt;span class="pre"&gt;-c&lt;/span&gt; 0 1&lt;/tt&gt; command printing blank
lines at the end of the output; we can avoid this by stripping trailing tabs
before passing the table on.  Hence, the final command line, that works
regardless of how short the last column happens to be, is:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
sed -e 's/ \{2,\}/\t/g' table.txt | rs -c -C -T -n | sed -e 's/\t*$//' | rs -c 0 1
&lt;/pre&gt;
&lt;p&gt;On the other hand, if the table we’re converting to a list that happens to be
read by going across the first row, then the second row, etc. — e.g., if it was
produced with &lt;tt class="docutils literal"&gt;rs &lt;span class="pre"&gt;-e&lt;/span&gt;&lt;/tt&gt; without the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-t&lt;/span&gt;&lt;/tt&gt; option — instead of being read by
going down the first, second, etc. column, then the whole business with &lt;tt class="docutils literal"&gt;rs &lt;span class="pre"&gt;-c&lt;/span&gt;
&lt;span class="pre"&gt;-C&lt;/span&gt; &lt;span class="pre"&gt;-T&lt;/span&gt; &lt;span class="pre"&gt;-n&lt;/span&gt;&lt;/tt&gt; and stripping trailing tabs is unnecessary, and we can turn this
table:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Dapper Drake      Edgy Eft          Feisty Fawn       Gutsy Gibbon
Hardy Heron       Intrepid Ibex     Jaunty Jackalope  Karmic Koala
Lucid Lynx        Maverick Meerkat  Natty Narwhal     Oneiric Ocelot
Precise Pangolin  Quantal Quetzal   Raring Ringtail   Saucy Salamander
Trusty Tahr       Utopic Unicorn    Vivid Vervet      Wily Werewolf
Xenial Xerus      Yakkety Yak
&lt;/pre&gt;
&lt;p&gt;into a list by just running:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
sed -e 's/ \{2,\}/\t/g' table.txt | rs -c 0 1
&lt;/pre&gt;
&lt;/div&gt;
</content><category term="Software"></category><category term="rs"></category><category term="tables"></category><category term="text processing"></category><category term="Unix utilities"></category></entry><entry><title>Basics of Writing Unix Man Pages</title><link href="https://jwodder.github.io/kbits/posts/writing-manpages/" rel="alternate"></link><published>2022-11-24T00:00:00-05:00</published><updated>2026-05-22T00:00:00-04:00</updated><author><name>John T. Wodder II</name></author><id>tag:jwodder.github.io,2022-11-24:/kbits/posts/writing-manpages/</id><summary type="html">&lt;p class="first last"&gt;A guide to the basic syntax &amp;amp; commands of Unix man pages&lt;/p&gt;
</summary><content type="html">&lt;p&gt;On Unix-like systems, the documents that one views with the &lt;tt class="docutils literal"&gt;man&lt;/tt&gt; command
(known as “man pages”) are written in a markup language called “roff” (short
for “run off”) that dates back to the pre-Unix days in the 1960’s.  roff is
technically a full-blown programming language with numerous features, but you
only need to know a very small subset in order to produce most man pages.  This
article will describe that subset so that you can go on to write man pages for
your own software.&lt;/p&gt;
&lt;p&gt;Man pages, like most roff documents, use a roff &lt;em&gt;macro package&lt;/em&gt; that defines a
set of high-level commands.  The macro package used by most man pages is,
unsurprisingly, the &lt;tt class="docutils literal"&gt;man&lt;/tt&gt; package, and that is what is covered here.  Some
man pages instead use the &lt;tt class="docutils literal"&gt;mdoc&lt;/tt&gt; package, which originated in BSD.  Modern
versions of the &lt;tt class="docutils literal"&gt;man&lt;/tt&gt; command use the &lt;tt class="docutils literal"&gt;mandoc&lt;/tt&gt; package for processing man
pages, which autodetects whether a file is written using &lt;tt class="docutils literal"&gt;man&lt;/tt&gt; or &lt;tt class="docutils literal"&gt;mdoc&lt;/tt&gt;
and processes it accordingly.&lt;/p&gt;
&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title"&gt;Contents&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#roff-syntax" id="toc-entry-1"&gt;roff Syntax&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#document-structure-commands" id="toc-entry-2"&gt;Document Structure Commands&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#font-commands" id="toc-entry-3"&gt;Font Commands&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#additional-escape-sequences" id="toc-entry-4"&gt;Additional Escape Sequences&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#select-non-ascii-characters" id="toc-entry-5"&gt;Select Non-ASCII Characters&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#special-ascii-characters" id="toc-entry-6"&gt;Special ASCII Characters&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#other" id="toc-entry-7"&gt;Other&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#man-page-conventions" id="toc-entry-8"&gt;Man Page Conventions&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#manual-sections" id="toc-entry-9"&gt;Manual Sections&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#sections-of-a-man-page" id="toc-entry-10"&gt;Sections of a Man Page&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#other-conventions" id="toc-entry-11"&gt;Other Conventions&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#rendering-a-man-page" id="toc-entry-12"&gt;Rendering a Man Page&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#a-sample-man-page" id="toc-entry-13"&gt;A Sample Man Page&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#further-references" id="toc-entry-14"&gt;Further References&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="roff-syntax"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;roff Syntax&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A roff file is composed of a mixture of &lt;em&gt;control lines&lt;/em&gt; — lines that start with
a &lt;em&gt;control character&lt;/em&gt;, usually a period or single-quote — and &lt;em&gt;text lines&lt;/em&gt; —
lines that do not.&lt;/p&gt;
&lt;p&gt;Control lines are commands to roff (also known as &lt;em&gt;requests&lt;/em&gt;).  They consist of
a control character &amp;amp; a command name followed by some number of space-separated
(not tab-separated!) arguments.  To include spaces in an argument, either
escape them with a backslash or enclose the entire argument in double-quotes;
to use double-quotes inside an argument, write them as &lt;tt class="docutils literal"&gt;\(dq&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;For example, the input:&lt;/p&gt;
&lt;pre class="code groff literal-block"&gt;
.&lt;span class="k"&gt;B&lt;/span&gt; &lt;span class="s"&gt;Bold&lt;/span&gt;
and brash?  More like
.&lt;span class="k"&gt;IR&lt;/span&gt; &lt;span class="s"&gt;Belongs&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot; in the &amp;quot;&lt;/span&gt; &lt;span class="s"&gt;Trash.&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;contains the command &lt;tt class="docutils literal"&gt;.B&lt;/tt&gt; (for making text bold) with the argument “Bold” and
the command &lt;tt class="docutils literal"&gt;.IR&lt;/tt&gt; (for alternating between italic and roman text) with the
arguments “Belongs” (which will be italic), “ in the ” (which will be roman),
and “Trash” (which will be italic).  This is all rendered as:&lt;/p&gt;
&lt;blockquote&gt;
&lt;strong&gt;Bold&lt;/strong&gt; and brash?  More like &lt;em&gt;Belongs&lt;/em&gt; in the &lt;em&gt;Trash.&lt;/em&gt;&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;There may be any number of spaces &amp;amp; tabs (or none at all) between the control
character and the command name, but the control character must be the first
character in the line.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;A line with just a period is ignored.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Text lines give the text that will be displayed.  They can contain &lt;em&gt;escape
sequences&lt;/em&gt;, inline commands that start with backslashes.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;Whitespace around escape sequences is significant and is not discarded.  The
syntax of an escape sequence allows roff to automatically determine where it
ends; for example, escape sequences starting with &lt;tt class="docutils literal"&gt;\(&lt;/tt&gt; are always followed
by two more characters to complete the sequence, and so an escape sequence
like &lt;tt class="docutils literal"&gt;\(em&lt;/tt&gt; (em-dash) can be embedded in the middle of a word:
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;foo\(embar&lt;/span&gt;&lt;/tt&gt; becomes “foo—bar”.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;To start a text line with a period, precede the period with either a
backslash or the escape sequence &lt;tt class="docutils literal"&gt;\&amp;amp;&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;To render a literal backslash in text, use the escape sequence &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;\\\\&lt;/span&gt;&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;\e&lt;/tt&gt;, or &lt;tt class="docutils literal"&gt;\(rs&lt;/tt&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example, the input from above can be rewritten using escape sequences like
so:&lt;/p&gt;
&lt;pre class="code groff literal-block"&gt;
&lt;span class="se"&gt;\fB&lt;/span&gt;Bold&lt;span class="se"&gt;\fR&lt;/span&gt; and brash?  More like &lt;span class="se"&gt;\fI&lt;/span&gt;Belongs&lt;span class="se"&gt;\fR&lt;/span&gt; in the &lt;span class="se"&gt;\fI&lt;/span&gt;Trash.&lt;span class="se"&gt;\fR&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;A comment consists of a backslash and double quote (&lt;tt class="docutils literal"&gt;\&amp;quot;&lt;/tt&gt;) and extends to the
end of the line.  A full-line comment can be formed by using the command
&lt;tt class="docutils literal"&gt;.\&amp;quot;&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;A single logical line can be broken across multiple physical lines by placing a
backslash at the end of each physical line.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="document-structure-commands"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Document Structure Commands&lt;/a&gt;&lt;/h2&gt;
&lt;dl class="docutils"&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.TH title section &lt;span class="pre"&gt;[footer-middle]&lt;/span&gt; &lt;span class="pre"&gt;[footer-outside]&lt;/span&gt; &lt;span class="pre"&gt;[header-middle]&lt;/span&gt;&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p class="first"&gt;This must be the first non-comment command in a man page, and it must appear
exactly once.  It sets the page title (which is conventionally in all-caps)
and section number for the man page (see “&lt;a class="reference internal" href="#manual-sections"&gt;Manual Sections&lt;/a&gt;” below) to the
given values, to be displayed in the form &lt;tt class="docutils literal"&gt;title(section)&lt;/tt&gt; at the left &amp;amp;
right sides of the header of the rendered manual page.&lt;/p&gt;
&lt;p&gt;The remaining three arguments are optional.  To omit an argument but still
be able to specify an argument after it, write &lt;tt class="docutils literal"&gt;\&amp;amp;&lt;/tt&gt; in place of the
omitted argument.&lt;/p&gt;
&lt;ul class="last"&gt;
&lt;li&gt;&lt;p class="first"&gt;If &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;footer-middle&lt;/span&gt;&lt;/tt&gt; is given, it will be rendered in the middle of the
footer.  This argument is usually set to the date the man page was
written.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;If &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;footer-outside&lt;/span&gt;&lt;/tt&gt; is given, it will be rendered on the left side of
the footer.  This is usually set to the version of the software being
documented.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;If &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;header-middle&lt;/span&gt;&lt;/tt&gt; is given, it will be rendered in the middle of the
header.  If it is omitted and &lt;tt class="docutils literal"&gt;section&lt;/tt&gt; is a number from 1 to 9,
certain versions of &lt;tt class="docutils literal"&gt;man&lt;/tt&gt; will supply a default value.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.SH [name]&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Start a section with the given name.  If no argument is given, the next
line will be used as the name.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.SS [name]&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Start a subsection with the given name.  If no argument is given, the next
line will be used as the name.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.LP&lt;/tt&gt; or &lt;tt class="docutils literal"&gt;.PP&lt;/tt&gt; or &lt;tt class="docutils literal"&gt;.P&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Paragraph break, resetting any indentation caused by the &lt;tt class="docutils literal"&gt;.TP&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;.IP&lt;/tt&gt;,
or &lt;tt class="docutils literal"&gt;.HP&lt;/tt&gt; command&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.TP [n]&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Start a labelled, indented paragraph.  The next text line after this
command is the paragraph label, and any following text lines up to the next
&lt;tt class="docutils literal"&gt;.PP&lt;/tt&gt; will be indented.  If a numeric argument is given, the paragraph
will be indented by that many columns.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.IP [text] [n]&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p class="first"&gt;Start an indented paragraph.  The text argument, if given, will be used as
the paragraph’s bullet/“tag”; this is usually the bullet escape sequence
(&lt;tt class="docutils literal"&gt;\(bu&lt;/tt&gt;), the em-dash escape sequence (&lt;tt class="docutils literal"&gt;\(em&lt;/tt&gt;), or a number followed by
a period.  If no text argument is supplied, no bullet will be present, but
the following paragraph will still be indented; this can be used to start a
new indented paragraph after an initial indented paragraph created by
&lt;tt class="docutils literal"&gt;.TP&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;.IP&lt;/tt&gt;, or &lt;tt class="docutils literal"&gt;.HP&lt;/tt&gt;.&lt;/p&gt;
&lt;p class="last"&gt;If a numeric second argument is given, the paragraph will be indented by
that many columns.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.HP [n]&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Start an indented paragraph in which the first line is not indented.  If a
numeric second argument is given, the paragraph will be indented by that
many columns.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.RS [n]&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Increase the amount of indentation until a corresponding &lt;tt class="docutils literal"&gt;.RE&lt;/tt&gt;.  If a
numeric second argument is given, the indentation will be increased by that
many columns.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.RE&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Undo the increase in indentation caused by the last &lt;tt class="docutils literal"&gt;.RS&lt;/tt&gt;&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.br&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Insert a line break&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.sp&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Skip a line&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.sp N&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Skip &lt;tt class="docutils literal"&gt;N&lt;/tt&gt; lines&lt;/dd&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;div class="section" id="font-commands"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Font Commands&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The following escape sequences can be used to change the font within a text
line:&lt;/p&gt;
&lt;dl class="docutils"&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;\fB&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Change the font to bold&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;\fI&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Change the font to italic (on a terminal, underlined)&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;\fR&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Change the font to roman&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;\fP&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Change back to the previous font&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;The following requests render an argument in a given font:&lt;/p&gt;
&lt;dl class="docutils"&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.B [text]&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Renders the given text (or the text of the next line if no argument is
given) in bold with a word break before &amp;amp; after.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.I [text]&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Renders the given text (or the text of the next line if no argument is
given) in italic (on a terminal, underlined) with a word break before &amp;amp;
after.&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;The following commands take multiple arguments and render them in alternating
fonts.  A word break/whitespace will be inserted before &amp;amp; after the arguments,
but there will be no words breaks/whitespace inserted between the arguments.
For example, the following:&lt;/p&gt;
&lt;pre class="code groff literal-block"&gt;
This is
.&lt;span class="k"&gt;BI&lt;/span&gt; &lt;span class="s"&gt;very&lt;/span&gt; &lt;span class="s"&gt;styled&lt;/span&gt;
text.
&lt;/pre&gt;
&lt;p&gt;will render as:&lt;/p&gt;
&lt;blockquote&gt;
This is &lt;strong&gt;very&lt;/strong&gt;&lt;em&gt;styled&lt;/em&gt; text.&lt;/blockquote&gt;
&lt;dl class="docutils"&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.RB text ...&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Renders the given arguments in alternating roman and bold, roman first.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.BR text ...&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Renders the given arguments in alternating bold and roman, bold first.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.RI text ...&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Renders the given arguments in alternating roman and italic/underlined,
roman first.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.IR text ...&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Renders the given arguments in alternating italic/underlined and roman,
italic/underlined first.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.BI text ...&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Renders the given arguments in alternating bold and italic/underlined, bold
first.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;.IB text ...&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Renders the given arguments in alternating italic/underlined and bold,
italic/underlined first.&lt;/dd&gt;
&lt;/dl&gt;
&lt;div class="admonition tip"&gt;
&lt;p class="first admonition-title"&gt;Tip&lt;/p&gt;
&lt;p class="last"&gt;While modern groff lets you use these commands with any number of
arguments, traditional implementations limit usage to six arguments; keep
this in mind if you want to make your man page portable.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="additional-escape-sequences"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Additional Escape Sequences&lt;/a&gt;&lt;/h2&gt;
&lt;div class="section" id="select-non-ascii-characters"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Select Non-ASCII Characters&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;See &lt;a class="reference external" href="https://man7.org/linux/man-pages/man7/groff_char.7.html"&gt;&lt;tt class="docutils literal"&gt;grof_char(7)&lt;/tt&gt;&lt;/a&gt; for the complete set of available character escape sequences.&lt;/p&gt;
&lt;table border="1" class="docutils"&gt;
&lt;colgroup&gt;
&lt;col width="24%" /&gt;
&lt;col width="76%" /&gt;
&lt;/colgroup&gt;
&lt;thead valign="bottom"&gt;
&lt;tr&gt;&lt;th class="head"&gt;Escape&lt;/th&gt;
&lt;th class="head"&gt;Character&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(bu&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;bullet (•)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\*R&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;registration symbol (®)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;\*(Tm&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;trademark symbol (™)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(co&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;copyright (©)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(em&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;em-dash (—)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(en&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;en-dash (–)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(rq&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;right double-quote (“)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(lq&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;left double-quote (”)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(oq&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;left single-quote (‘)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(cq&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;right single-quote (’)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;When viewing a man page in the terminal, not all installations will display
Unicode characters.  On systems that display man pages in ASCII (which
include macOS as of Big Sur), non-ASCII characters will be rendered as the
visually closest ASCII character where possible.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="special-ascii-characters"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Special ASCII Characters&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Some output devices transform certain ASCII input characters to similar Unicode
characters, so the following escape sequences can be used to ensure that the
desired ASCII character appears in the rendered man page:&lt;/p&gt;
&lt;table border="1" class="docutils"&gt;
&lt;colgroup&gt;
&lt;col width="22%" /&gt;
&lt;col width="78%" /&gt;
&lt;/colgroup&gt;
&lt;thead valign="bottom"&gt;
&lt;tr&gt;&lt;th class="head"&gt;Escape&lt;/th&gt;
&lt;th class="head"&gt;Character&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(aq&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Apostrophe (‘)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(ga&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Grave accent (`)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(ha&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Caret/circumflex accent (^)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\(ti&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Tilde (~)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;\-&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Hyphen/minus (-)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div class="section" id="other"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Other&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;A backslash followed by a space produces a non-breaking space that remains at
a fixed width when text is justified.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;\~&lt;/tt&gt; produces a non-breaking space that nevertheless stretches like a
normal inter-word space when justifying text.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;\&amp;amp;&lt;/tt&gt; produces a non-printable, zero-width character.  It can be placed next
to a token to deprive it of any special meaning; for example, it can be
placed after a period at the end of an abbreviation to prevent it from being
treated as the end of a sentence.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="man-page-conventions"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Man Page Conventions&lt;/a&gt;&lt;/h2&gt;
&lt;div class="section" id="manual-sections"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Manual Sections&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Each man page is traditionally placed into one of nine manual &lt;em&gt;sections&lt;/em&gt; (not
to be confused with the sections within a man page created by the &lt;tt class="docutils literal"&gt;.SH&lt;/tt&gt;
command; for that, see below).  The pages for a given section are stored
together, and the section number is also used as the file extension.  The
sections are:&lt;/p&gt;
&lt;ol class="arabic"&gt;
&lt;li&gt;&lt;p class="first"&gt;Commands for use by general users&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;C system calls&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;C library functions, libraries, &amp;amp; headers&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Devices, special files, and sockets&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;File formats&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Games&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Miscellaneous&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Commands for use by system administrators (including servers/daemons)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;C kernel functions&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class="section" id="sections-of-a-man-page"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Sections of a Man Page&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The contents of a man page are divided into sections by the &lt;tt class="docutils literal"&gt;.SH&lt;/tt&gt; command.
Different sources give slightly different lists of the “standard” sections, but
the most common, in roughly the order they should appear in a man page, are:&lt;/p&gt;
&lt;dl class="docutils"&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;NAME&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p class="first"&gt;Gives the name of the man page and a short description of what it
documents.  This is usually considered the only mandatory section.&lt;/p&gt;
&lt;p class="last"&gt;In order for a man page named “foobar” to be properly indexed by &lt;tt class="docutils literal"&gt;whatis&lt;/tt&gt;
and &lt;tt class="docutils literal"&gt;apropos&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;NAME&lt;/tt&gt; must be the first section in the man page, and
the &lt;tt class="docutils literal"&gt;.SH NAME&lt;/tt&gt; line must be followed immediately by a line of the form
&lt;tt class="docutils literal"&gt;foobar \- short description of foobar&lt;/tt&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;SYNOPSIS&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p class="first"&gt;Shows the syntax for invoking a command or calling a C function.&lt;/p&gt;
&lt;p&gt;The synopsis for a command usually follows the following conventions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;Text that should be entered as-is by the user (e.g., options and the name
of the command) should be in &lt;strong&gt;bold&lt;/strong&gt;, while placeholder text that should
be replaced with some value by the user (e.g., command arguments) should
be in &lt;em&gt;italics/underlined&lt;/em&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Optional syntax elements (e.g., most options) should be enclosed in
square brackets.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Alternative forms of a syntax element (e.g., the short and long form of
an option) should be separated by whitespace and a vertical bar.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Syntax elements that can be repeated (e.g., arguments that can be given
multiple times) are indicated by appending three periods (&lt;tt class="docutils literal"&gt;...&lt;/tt&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="last"&gt;See &lt;a class="reference internal" href="#a-sample-man-page"&gt;A Sample Man Page&lt;/a&gt; below for an example of these rules in action.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;DESCRIPTION&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;An explanation of what the command, function, etc. does&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;OPTIONS&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;A list of any command-line options a program takes and their meanings.
This list is usually created using &lt;tt class="docutils literal"&gt;.TP&lt;/tt&gt; or &lt;tt class="docutils literal"&gt;.IP&lt;/tt&gt; to produce paragraphs
labeled with the option they describe, with each option in &lt;strong&gt;bold&lt;/strong&gt; and any
argument it may take in &lt;em&gt;italics/underlined&lt;/em&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;EXIT STATUS&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;A list of the possible exit statuses for a command and their meanings&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;ENVIRONMENT&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;A description of any environment variables that affect the command or
function&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;FILES&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;A description of any files the command uses (configuration files, startup
files, etc.).  It is recommended that file paths be styled in
&lt;em&gt;italics/underlined&lt;/em&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;NOTES&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Any miscellaneous notes&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;BUGS&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;A list of known shortcomings in the documented software or functionality&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;EXAMPLES&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Examples of how to use the software or functionality&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;AUTHORS&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;A list of the authors of the software and/or man page&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;REPORTING BUGS&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Information on how to report any bugs found in the software&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;COPYRIGHT&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;Copyright/license details&lt;/dd&gt;
&lt;dt&gt;&lt;tt class="docutils literal"&gt;SEE ALSO&lt;/tt&gt;&lt;/dt&gt;
&lt;dd&gt;A comma-separated list of related man pages and/or other documents.
References to other man pages should be formatted with the name in bold and
the section number in roman enclosed in parentheses.&lt;/dd&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;div class="section" id="other-conventions"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Other Conventions&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;Use &lt;tt class="docutils literal"&gt;\-&lt;/tt&gt; instead of plain &lt;tt class="docutils literal"&gt;-&lt;/tt&gt; for ASCII hyphens, e.g., in command-line
options.  Use plain &lt;tt class="docutils literal"&gt;-&lt;/tt&gt; in hyphenated words.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Blank lines are discouraged, as they may not render correctly in all output
formats.  Use the &lt;tt class="docutils literal"&gt;.sp&lt;/tt&gt; command instead to produce a blank line, or use
&lt;tt class="docutils literal"&gt;.PP&lt;/tt&gt; to start a new paragraph.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Each sentence should typically start on a new line.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Use only a single space between words in text; multiple spaces will not be
collapsed into one when rendering.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="rendering-a-man-page"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Rendering a Man Page&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To render a man page in the terminal the way that &lt;tt class="docutils literal"&gt;man&lt;/tt&gt; would, run &lt;tt class="docutils literal"&gt;man &lt;span class="pre"&gt;-l&lt;/span&gt;
path/to/man/page&lt;/tt&gt;.  (On macOS, you have to instead run &lt;tt class="docutils literal"&gt;mandoc &lt;span class="pre"&gt;-a&lt;/span&gt;
path/to/man/page&lt;/tt&gt;).  You may also want to pass the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--warnings&lt;/span&gt;&lt;/tt&gt; option
(&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-Wall&lt;/span&gt;&lt;/tt&gt; for &lt;tt class="docutils literal"&gt;mandoc&lt;/tt&gt;) in order to catch any problematic syntax.&lt;/p&gt;
&lt;p&gt;If your version of &lt;tt class="docutils literal"&gt;man&lt;/tt&gt; does not support the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-l&lt;/span&gt;&lt;/tt&gt; option, you can instead
run &lt;tt class="docutils literal"&gt;groff&lt;/tt&gt; (GNU roff, the typical roff implementation on nearly all Unix
machines nowadays) directly with &lt;tt class="docutils literal"&gt;groff &lt;span class="pre"&gt;-man&lt;/span&gt; &lt;span class="pre"&gt;-Tutf8&lt;/span&gt; path/to/man/page | less
&lt;span class="pre"&gt;-is&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;Of course, groff can render to more than just terminals by changing the value
passed to the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-T&lt;/span&gt;&lt;/tt&gt; option in the &lt;tt class="docutils literal"&gt;groff&lt;/tt&gt; command.  Values of interest
include &lt;tt class="docutils literal"&gt;pdf&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;ps&lt;/tt&gt; (for PostScript), and &lt;tt class="docutils literal"&gt;html&lt;/tt&gt;; these require the
&lt;tt class="docutils literal"&gt;gropdf&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;grops&lt;/tt&gt;, and &lt;tt class="docutils literal"&gt;grohtml&lt;/tt&gt; commands, respectively, to be installed
in order to work.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="a-sample-man-page"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;A Sample Man Page&lt;/a&gt;&lt;/h2&gt;
&lt;pre class="code groff literal-block"&gt;
.&lt;span class="k"&gt;TH&lt;/span&gt; &lt;span class="s"&gt;FOOBAR&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="m"&gt;2022&lt;/span&gt;&lt;span class="s"&gt;-11-24&lt;/span&gt; &lt;span class="s"&gt;v1.0&lt;/span&gt;
.&lt;span class="k"&gt;SH&lt;/span&gt; &lt;span class="s"&gt;NAME&lt;/span&gt;
foobar &lt;span class="se"&gt;\-&lt;/span&gt; foo all your bars
.&lt;span class="k"&gt;SH&lt;/span&gt; &lt;span class="s"&gt;SYNOPSIS&lt;/span&gt;
.&lt;span class="k"&gt;B&lt;/span&gt; &lt;span class="s"&gt;foobar&lt;/span&gt;
[&lt;span class="se"&gt;\fB\-&lt;/span&gt;a&lt;span class="se"&gt;\fR&lt;/span&gt; &lt;span class="se"&gt;\fI&lt;/span&gt;arg&lt;span class="se"&gt;\fP&lt;/span&gt;]
.&lt;span class="k"&gt;RB&lt;/span&gt; &lt;span class="s"&gt;[&lt;/span&gt; &lt;span class="se"&gt;\-&lt;/span&gt;&lt;span class="s"&gt;f&lt;/span&gt; &lt;span class="s"&gt;|&lt;/span&gt; &lt;span class="se"&gt;\-\-&lt;/span&gt;&lt;span class="s"&gt;fu&lt;/span&gt; &lt;span class="s"&gt;]&lt;/span&gt;
.&lt;span class="k"&gt;RB&lt;/span&gt; &lt;span class="s"&gt;[&lt;/span&gt; &lt;span class="se"&gt;\-&lt;/span&gt;&lt;span class="s"&gt;xyz&lt;/span&gt; &lt;span class="s"&gt;]&lt;/span&gt;
.&lt;span class="k"&gt;IR&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;bar &amp;quot;&lt;/span&gt; &lt;span class="s"&gt;...&lt;/span&gt;
.&lt;span class="k"&gt;SH&lt;/span&gt; &lt;span class="s"&gt;DESCRIPTION&lt;/span&gt;
.&lt;span class="k"&gt;B&lt;/span&gt; &lt;span class="s"&gt;foobar&lt;/span&gt;
takes a list of one or more
.&lt;span class="k"&gt;IR&lt;/span&gt; &lt;span class="s"&gt;bar&lt;/span&gt; &lt;span class="s"&gt;s&lt;/span&gt;
and foos each of them.
.&lt;span class="k"&gt;PP&lt;/span&gt;
In detail, lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
.&lt;span class="k"&gt;SH&lt;/span&gt; &lt;span class="s"&gt;OPTIONS&lt;/span&gt;
.&lt;span class="k"&gt;TP&lt;/span&gt;
.&lt;span class="k"&gt;BI&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;\-a &amp;quot;&lt;/span&gt; &lt;span class="s"&gt;arg&lt;/span&gt;
Put the apple at
.&lt;span class="k"&gt;IR&lt;/span&gt; &lt;span class="s"&gt;arg&lt;/span&gt; &lt;span class="s"&gt;.&lt;/span&gt;
.&lt;span class="k"&gt;TP&lt;/span&gt;
.&lt;span class="k"&gt;BR&lt;/span&gt; &lt;span class="se"&gt;\-&lt;/span&gt;&lt;span class="s"&gt;f&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;, &amp;quot;&lt;/span&gt; &lt;span class="se"&gt;\-\-&lt;/span&gt;&lt;span class="s"&gt;fu&lt;/span&gt;
Do a FUBAR instead.
.&lt;span class="k"&gt;IP&lt;/span&gt;
Note that this can permanently destroy your computer.
.&lt;span class="k"&gt;IP&lt;/span&gt; &lt;span class="se"&gt;\fB\-&lt;/span&gt;&lt;span class="s"&gt;x\fR&lt;/span&gt;
Be exact about it.
.&lt;span class="k"&gt;TP&lt;/span&gt;
.&lt;span class="k"&gt;B&lt;/span&gt; &lt;span class="s"&gt;-y&lt;/span&gt;
Be yucky about it.
.&lt;span class="k"&gt;IP&lt;/span&gt; &lt;span class="se"&gt;\fB&lt;/span&gt;&lt;span class="s"&gt;-z\fR&lt;/span&gt;
Be zucchini about it.
.&lt;span class="k"&gt;SH&lt;/span&gt; &lt;span class="s"&gt;FILES&lt;/span&gt;
.&lt;span class="k"&gt;TP&lt;/span&gt;
.&lt;span class="k"&gt;I&lt;/span&gt; &lt;span class="s"&gt;~/.cache/foo&lt;/span&gt;
This is where the bars are stored.
.&lt;span class="k"&gt;SH&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;SEE ALSO&amp;quot;&lt;/span&gt;
.&lt;span class="k"&gt;BR&lt;/span&gt; &lt;span class="s"&gt;man&lt;/span&gt; &lt;span class="s"&gt;(1),&lt;/span&gt;
.&lt;span class="k"&gt;BR&lt;/span&gt; &lt;span class="s"&gt;groff&lt;/span&gt; &lt;span class="s"&gt;(7),&lt;/span&gt;
.&lt;span class="k"&gt;BR&lt;/span&gt; &lt;span class="s"&gt;groff_man&lt;/span&gt; &lt;span class="s"&gt;(7)&lt;/span&gt;
.&lt;span class="k"&gt;PP&lt;/span&gt;
.&lt;span class="k"&gt;I&lt;/span&gt; &lt;span class="s"&gt;A&lt;/span&gt; &lt;span class="s"&gt;Brief&lt;/span&gt; &lt;span class="s"&gt;History&lt;/span&gt; &lt;span class="s"&gt;of&lt;/span&gt; &lt;span class="s"&gt;Foo&lt;/span&gt;
by Fabian Oscar Oh
.&lt;span class="k"&gt;PP&lt;/span&gt;
.&lt;span class="k"&gt;RI&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;https://www.example.com/foo/bar.html&lt;/span&gt; &lt;span class="s"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;[&lt;a class="reference external" href="https://jwodder.github.io/kbits/posts/writing-manpages/foobar.1"&gt;Download this file&lt;/a&gt;]&lt;/p&gt;
&lt;p&gt;Rendered:&lt;/p&gt;
&lt;script id="asciicast-LtGNGNNqtSYDLi72H6e8Yp1sQ" src="https://asciinema.org/a/LtGNGNNqtSYDLi72H6e8Yp1sQ.js" async data-autoplay="true" data-loop="true"&gt;&lt;/script&gt;&lt;p&gt;[&lt;a class="reference external" href="https://asciinema.org/a/LtGNGNNqtSYDLi72H6e8Yp1sQ"&gt;View animation on asciinema.org&lt;/a&gt;]&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="further-references"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Further References&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;groff(7)&lt;/tt&gt; man page: &amp;lt;&lt;a class="reference external" href="https://man7.org/linux/man-pages/man7/groff.7.html"&gt;https://man7.org/linux/man-pages/man7/groff.7.html&lt;/a&gt;&amp;gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;groff_char(7)&lt;/tt&gt; man page: &amp;lt;&lt;a class="reference external" href="https://man7.org/linux/man-pages/man7/groff_char.7.html"&gt;https://man7.org/linux/man-pages/man7/groff_char.7.html&lt;/a&gt;&amp;gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;groff_man(7)&lt;/tt&gt; man page: &amp;lt;&lt;a class="reference external" href="https://man7.org/linux/man-pages/man7/groff_man.7.html"&gt;https://man7.org/linux/man-pages/man7/groff_man.7.html&lt;/a&gt;&amp;gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;man-pages(7)&lt;/span&gt;&lt;/tt&gt; man page: &amp;lt;&lt;a class="reference external" href="https://man7.org/linux/man-pages/man7/man-pages.7.html"&gt;https://man7.org/linux/man-pages/man7/man-pages.7.html&lt;/a&gt;&amp;gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><category term="Software"></category><category term="documentation"></category><category term="groff"></category><category term="roff"></category><category term="markup"></category><category term="man pages"></category><category term="UNIX"></category><category term="Unix utilities"></category></entry><entry><title>Special Version Control Files</title><link href="https://jwodder.github.io/kbits/posts/vcs-files/" rel="alternate"></link><published>2021-06-22T00:00:00-04:00</published><updated>2022-02-06T00:00:00-05:00</updated><author><name>John T. Wodder II</name></author><id>tag:jwodder.github.io,2021-06-22:/kbits/posts/vcs-files/</id><summary type="html">&lt;p class="first last"&gt;A list of version control system-specific files that one may find in the
working directories of common version control systems&lt;/p&gt;
</summary><content type="html">&lt;p&gt;The following is a list of VCS-specific files that one may find in the working
directories of common version control systems.  This list is useful for, say,
knowing what files to ignore when traversing a project directory.&lt;/p&gt;
&lt;p&gt;Did I leave anything out?  &lt;a class="reference external" href="https://github.com/jwodder/kbits"&gt;Feel free to send a pull request.&lt;/a&gt;&lt;/p&gt;
&lt;table border="1" class="docutils align-center"&gt;
&lt;thead valign="bottom"&gt;
&lt;tr&gt;&lt;th class="head"&gt;VCS&lt;/th&gt;
&lt;th class="head"&gt;File/Directory&lt;/th&gt;
&lt;th class="head"&gt;Purpose&lt;/th&gt;
&lt;th class="head"&gt;Documentation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td rowspan="5"&gt;&lt;a class="reference external" href="https://git-scm.com"&gt;Git&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;.git/&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Repository data&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="https://git-scm.com/docs/gitrepository-layout"&gt;gitrepository-layout(5)&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;.gitattributes&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Defines per-path attributes&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="https://git-scm.com/docs/gitattributes"&gt;gitattributes(5)&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;.gitignore&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Lists files to exclude from version control&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="https://git-scm.com/docs/gitignore"&gt;gitignore(5)&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;.gitmodules&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Defines submodules&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="https://git-scm.com/docs/gitmodules"&gt;gitmodules(5)&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;.mailmap&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Maps names &amp;amp; e-mails to canonical values&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="https://git-scm.com/docs/gitmailmap"&gt;gitmailmap(5)&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td rowspan="4"&gt;&lt;a class="reference external" href="https://www.mercurial-scm.org"&gt;Mercurial&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;.hg/&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Repository data&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="https://www.mercurial-scm.org/wiki/FileFormats"&gt;wiki:FileFormats&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;.hgignore&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Lists files to exclude from version control&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="https://www.selenic.com/mercurial/hgignore.5.html"&gt;hgignore(5)&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;.hgsigs&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Contains changeset signatures from the GPG extension&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;.hgtags&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Defines tags&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td rowspan="3"&gt;&lt;a class="reference external" href="http://darcs.net"&gt;Darcs&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;_darcs/&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Repository data&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;.binaries&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Lists files to treat as binary &lt;a class="footnote-reference" href="#fn1" id="footnote-reference-1"&gt;[1]&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="binaries"&gt;Manual&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;.boring&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Lists files to exclude from version control &lt;a class="footnote-reference" href="#fn1" id="footnote-reference-2"&gt;[1]&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="http://darcs.net/manual/Configuring_darcs.html#SECTION00410040000000000000"&gt;Manual&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td rowspan="2"&gt;&lt;a class="reference external" href="https://bazaar.canonical.com"&gt;Bazaar&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;.bzr/&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Repository data&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;.bzrignore&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Lists files to exclude from version control&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="http://doc.bazaar.canonical.com/bzr.2.7/en/user-reference/ignore-help.html"&gt;bzr ignore&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a class="reference external" href="http://subversion.apache.org"&gt;Subversion&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;.svn/&lt;/tt&gt; or
&lt;tt class="docutils literal"&gt;_svn/&lt;/tt&gt; &lt;a class="footnote-reference" href="#fn2" id="footnote-reference-3"&gt;[2]&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Local copy of repository data &lt;a class="footnote-reference" href="#fn3" id="footnote-reference-4"&gt;[3]&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a class="reference external" href="http://cvs.nongnu.org"&gt;CVS&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;CVS/&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Local copy of repository data (one per directory)&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="https://www.gnu.org/software/trans-coord/manual/cvs/html_node/Working-directory-storage.html"&gt;Manual&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td rowspan="2"&gt;&lt;a class="reference external" href="https://www.gnu.org/software/rcs/"&gt;RCS&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;filename&lt;/em&gt;&lt;tt class="docutils literal"&gt;,v&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Version history for &lt;em&gt;filename&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;&lt;a class="reference external" href="https://www.gnu.org/software/rcs/manual/html_node/Concepts.html#RCS-file"&gt;Manual&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;RCS/&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Conventional directory for storing &lt;tt class="docutils literal"&gt;*,v&lt;/tt&gt; files&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="fn1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[1]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-1"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-2"&gt;2&lt;/a&gt;)&lt;/em&gt; Darcs normally stores its binaries file and boring file inside the
&lt;tt class="docutils literal"&gt;_darcs/&lt;/tt&gt; directory, but it is possible to use any file under version
control in their place; the names listed here are the conventional names for
such files.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="fn2" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-3"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;For compatibility with ASP.NET, Subversion will use the name &lt;tt class="docutils literal"&gt;_svn&lt;/tt&gt;
instead of &lt;tt class="docutils literal"&gt;.svn&lt;/tt&gt; if the &lt;tt class="docutils literal"&gt;SVN_ASP_DOT_NET_HACK&lt;/tt&gt; environment variable is
defined.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="fn3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-4"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Prior to version 1.7, Subversion placed a &lt;tt class="docutils literal"&gt;.svn&lt;/tt&gt;/&lt;tt class="docutils literal"&gt;_svn&lt;/tt&gt; directory
in every subdirectory of the working directory under version control.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</content><category term="Software"></category><category term="Git"></category><category term="version control"></category><category term="dotfiles"></category></entry><entry><title>All About reStructuredText Hyperlinks</title><link href="https://jwodder.github.io/kbits/posts/rst-hyperlinks/" rel="alternate"></link><published>2020-07-28T00:00:00-04:00</published><updated>2020-07-28T00:00:00-04:00</updated><author><name>John T. Wodder II</name></author><id>tag:jwodder.github.io,2020-07-28:/kbits/posts/rst-hyperlinks/</id><summary type="html">&lt;p class="first last"&gt;Writing the various hyperlink syntaxes in reStructuredText, along with
internal hyperlinks and styling link text&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;a class="reference external" href="https://docutils.sourceforge.io/rst.html"&gt;reStructuredText&lt;/a&gt; offers a number of different ways to write hyperlinks, but
keeping track of all of them and their gotchas isn’t easy, and the information
is scattered around the spec.  This document aims to summarize all of the
hyperlink-related information from the &lt;a class="reference external" href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html"&gt;reStructuredText Markup Specification&lt;/a&gt;
in one (hopefully) well-organized place.&lt;/p&gt;
&lt;p&gt;This document describes reStructuredText hyperlinks as of &lt;a class="reference external" href="https://docutils.sourceforge.io"&gt;Docutils&lt;/a&gt; version
0.16, the latest version at time of writing.&lt;/p&gt;
&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title"&gt;Contents&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#standalone-hyperlinks" id="toc-entry-1"&gt;Standalone Hyperlinks&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#embedded-uri-hyperlinks" id="toc-entry-2"&gt;Embedded URI Hyperlinks&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#embedded-alias-hyperlinks-and-hyperlink-targets" id="toc-entry-3"&gt;Embedded Alias Hyperlinks and Hyperlink Targets&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#named-hyperlink-references" id="toc-entry-4"&gt;Named Hyperlink References&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#anonymous-hyperlinks" id="toc-entry-5"&gt;Anonymous Hyperlinks&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#embedded-uri-hyperlinks-and-automatic-reference-names" id="toc-entry-6"&gt;Embedded URI Hyperlinks and Automatic Reference Names&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#gotcha-duplicate-link-text" id="toc-entry-7"&gt;Gotcha: Duplicate Link Text&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#embedded-alias-hyperlinks-and-automatic-reference-names" id="toc-entry-8"&gt;Embedded Alias Hyperlinks and Automatic Reference Names&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#intra-document-links" id="toc-entry-9"&gt;Intra-Document Links&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#internal-hyperlink-targets" id="toc-entry-10"&gt;Internal Hyperlink Targets&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#named-directives" id="toc-entry-11"&gt;Named Directives&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#inline-internal-targets" id="toc-entry-12"&gt;Inline Internal Targets&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#implicit-hyperlink-targets-for-section-titles" id="toc-entry-13"&gt;Implicit Hyperlink Targets for Section Titles&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#chaining-hyperlink-targets" id="toc-entry-14"&gt;Chaining Hyperlink Targets&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#styling-link-text" id="toc-entry-15"&gt;Styling Link Text&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference internal" href="#link-text-within-a-word" id="toc-entry-16"&gt;Link Text within a Word&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="standalone-hyperlinks"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Standalone Hyperlinks&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Firstly, reStructuredText supports &lt;em&gt;standalone hyperlinks&lt;/em&gt; — just a bare URI
(including a scheme) or e-mail address without any link text:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Go to http://www.example.com to see something neat!&lt;span class="w"&gt;

&lt;/span&gt;E-mail me at me&amp;#64;example.com.
&lt;/pre&gt;
&lt;p&gt;The above renders as:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Go to &lt;a class="reference external" href="http://www.example.com"&gt;http://www.example.com&lt;/a&gt; to see something neat!&lt;/p&gt;
&lt;p&gt;E-mail me at &lt;a class="reference external" href="mailto:me&amp;#64;example.com"&gt;me&amp;#64;example.com&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note that, unlike Markdown, angle brackets are not required around standalone
hyperlinks, and if you do include angle brackets, the brackets will be present
in the rendered output.&lt;/p&gt;
&lt;p&gt;Also note that the scheme is required in order for a URI to be recognized as a
standalone hyperlink.  The domains names in the following will &lt;em&gt;not&lt;/em&gt; be
converted to hyperlinks:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Go to www.example.com — or to &amp;lt;www.example.org&amp;gt;!
&lt;/pre&gt;
&lt;p&gt;If you want a hyperlink that links to &lt;tt class="docutils literal"&gt;www.example.com&lt;/tt&gt; without a scheme and
uses the address as the link text, you can either write out the link the long
way as an &lt;a class="reference internal" href="#embedded-uri-hyperlinks"&gt;embedded URI hyperlink with link text&lt;/a&gt;,
or you can use embedded URI syntax without any link text, in which case the URI
becomes the link text.  For example:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Go to &lt;span class="s"&gt;`&amp;lt;www.example.com&amp;gt;`_&lt;/span&gt;.
&lt;/pre&gt;
&lt;p&gt;renders as:&lt;/p&gt;
&lt;blockquote&gt;
Go to &lt;a class="reference external" href="www.example.com"&gt;www.example.com&lt;/a&gt;.&lt;/blockquote&gt;
&lt;p&gt;This isn’t very useful for linking to domains, but it can be useful when you
want a link to a page in the same directory with the page filename used as the
link text:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
See &lt;span class="s"&gt;`&amp;lt;other_page.html&amp;gt;`_&lt;/span&gt; for other stuff.
&lt;/pre&gt;
&lt;p&gt;Rendered:&lt;/p&gt;
&lt;blockquote&gt;
See &lt;a class="reference external" href="other_page.html"&gt;other_page.html&lt;/a&gt; for other stuff.&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="section" id="embedded-uri-hyperlinks"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Embedded URI Hyperlinks&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you want to create a hyperlink with link text, the most straightforward way
to do so is with the &lt;em&gt;embedded URI&lt;/em&gt; syntax:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Here is &lt;span class="s"&gt;`a link &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;http://www.example.com&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt; to somewhere.
&lt;/pre&gt;
&lt;p&gt;This renders as:&lt;/p&gt;
&lt;blockquote&gt;
Here is &lt;a class="reference external" href="http://www.example.com"&gt;a link&lt;/a&gt; to somewhere.&lt;/blockquote&gt;
&lt;p&gt;The syntax consists of a backtick, the link text (with any embedded backticks
escaped with backslashes), whitespace, the target URI or e-mail address inside
angle brackets, another backtick, and a single underscore.  If the URI ends
with an underscore, the underscore must be preceded by a backslash in order to
not be parsed as an &lt;a class="reference internal" href="#embedded-alias"&gt;embedded alias&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note that link text is treated literally rather than processed for any inline
markup.  See “&lt;a class="reference internal" href="#styling-link-text"&gt;Styling Link Text&lt;/a&gt;” below for a way around this.&lt;/p&gt;
&lt;p&gt;There is a gotcha you may run into when defining two embedded URI hyperlinks
with the same link text but different URIs; &lt;a class="reference internal" href="#gotcha"&gt;see below for more information&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="embedded-alias-hyperlinks-and-hyperlink-targets"&gt;
&lt;span id="embedded-alias"&gt;&lt;/span&gt;&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Embedded Alias Hyperlinks and Hyperlink Targets&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If the URI is lengthy, or if you want to link to the same location more than
once, you may want to use an &lt;em&gt;embedded alias&lt;/em&gt;.  In this form, instead of
specifying the URI next to the link text, you specify a &lt;em&gt;hyperlink reference&lt;/em&gt;
containing a &lt;em&gt;reference name&lt;/em&gt;, and then you specify elsewhere (in a &lt;em&gt;hyperlink
target&lt;/em&gt;) what URI the reference name points to.  For example:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Here is &lt;span class="s"&gt;`a link &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;link_target_&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt; to somewhere.&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_link_target:&lt;/span&gt; http://www.example.com
&lt;/pre&gt;
&lt;p&gt;Rendered:&lt;/p&gt;
&lt;blockquote&gt;
Here is &lt;a class="reference external" href="http://www.example.com"&gt;a link&lt;/a&gt; to somewhere.&lt;/blockquote&gt;
&lt;p&gt;This syntax consists of two parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;At the location in the text where you want the link to appear, write a
backtick, the link text (with embedded backticks escaped), whitespace, a
reference name followed by an underscore and encased in angle brackets,
another backtick, and another underscore.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;The reference name can be any sequence of characters, though if it contains
any backticks or angle brackets, or begins or ends with space characters,
the characters in question will need to be escaped with backslashes when
using the name in an embedded alias link.&lt;/p&gt;
&lt;p&gt;When comparing two reference names for equality, runs of whitespace are
normalized to a single space, and alphabetic characters are converted to
lowercase.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul id="target"&gt;
&lt;li&gt;&lt;p class="first"&gt;Elsewhere in the reStructuredText document (either before or after the
hyperlink reference), write a &lt;em&gt;(external) hyperlink target&lt;/em&gt; on a line of its
own: optional whitespace, two periods, a space, an underscore, the same
reference name as before (&lt;em&gt;without&lt;/em&gt; the trailing underscore from before), a
colon, whitespace, and then the URI or e-mail address that the link should
point to.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;If the reference name contains any colons or is just a single underscore,
you must either escape the characters in question or else enclose the
reference name in backticks (in which case any backticks in the reference
name need to be escaped).  Either way, any leading or trailing space
characters or backticks in the reference name need to be escaped as well.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;If the URI contains any space characters or ends with an underscore, the
characters in question will need to be escaped with backslashes.&lt;/p&gt;
&lt;/li&gt;
&lt;li id="multiline"&gt;&lt;p class="first"&gt;The reference name and the URI may be on the same line, or you can put them
on separate lines, in which case the URI must be indented relative to the
two periods and there must be no intervening blank lines.  The URI may even
span multiple lines, in which case the lines are concatenated and any
whitespace in the URI that isn’t escaped is discarded.  For example, the
following hyperlink targets all map to the same URI:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_one-liner:&lt;/span&gt; http://docutils.sourceforge.net/rst.html&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_starts-on-this-line:&lt;/span&gt; http://&lt;span class="w"&gt;
&lt;/span&gt;   docutils.sourceforge.net/rst.html&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_entirely-below:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;   http://docutils.&lt;span class="w"&gt;
&lt;/span&gt;   sourceforge.net/rst.html
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;If the same reference name is used for two or more hyperlink targets with
different URIs, a warning is produced, and the reference name will be
unusable.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Hyperlink reference names, footnote labels, and citation labels share the
same namespace.  This means you can link to a footnote or citation by its
label, but it also means that you can’t define a reference name that is the
same as a footnote or citation label.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once a reference name is defined in a hyperlink target, the same reference name
can be used in any number of embedded alias links to create multiple hyperlinks
to the same destination.&lt;/p&gt;
&lt;p&gt;As with embedded URI hyperlinks, link text is treated literally rather than
processed for any inline markup.  See “&lt;a class="reference internal" href="#styling-link-text"&gt;Styling Link Text&lt;/a&gt;” below for a way
around this.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="named-hyperlink-references"&gt;
&lt;span id="named-hyperlink-reference"&gt;&lt;/span&gt;&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Named Hyperlink References&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We can simplify embedded aliases one step further and use the link text as the
reference name.  Simply omit the part in angle brackets:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Here is &lt;span class="s"&gt;`a link`_&lt;/span&gt; to somewhere.&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_a link:&lt;/span&gt; http://www.example.com
&lt;/pre&gt;
&lt;p&gt;If the link text ends with text inside angle brackets, at least one of the
angle brackets needs to be escaped — or an escaped space character should be
added to the end of the link text — in order to prevent the link from being
parsed as an embedded URI or alias hyperlink.&lt;/p&gt;
&lt;p id="simple-reference-name"&gt;This gets even simpler if the link text is a &lt;em&gt;simple reference name&lt;/em&gt; — a single
word (no whitespace) consisting only of letters, numbers, hyphens, underscores,
periods, colons, and/or plus signs, with no punctuation at the beginning or
end, and with no occurrences of two or more punctuation characters in a row.  A
simple reference name can be written with just the trailing underscore, no
backticks:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
This following word_ is a hyperlink.&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_word:&lt;/span&gt; https://www.example.com
&lt;/pre&gt;
&lt;p&gt;The same reference name may be used both as a named hyperlink reference and in
an embedded alias link:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
&lt;span class="s"&gt;`This site`_ links to the same location as `these words &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;This site_&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt;.&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_This site:&lt;/span&gt; https://www.example.com
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="anonymous-hyperlinks"&gt;
&lt;span id="anon"&gt;&lt;/span&gt;&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Anonymous Hyperlinks&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;What if you want to use the hyperlink reference syntax, but it’s for a URI that
will only be linked once, you don’t feel like giving it a reference name, and
the link text is too long to use as an efficient reference name?  The solution:
&lt;em&gt;anonymous hyperlinks&lt;/em&gt;.&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
&lt;span class="s"&gt;`This link`__&lt;/span&gt; goes to a dot-com.  &lt;span class="s"&gt;`This other link`__&lt;/span&gt; goes to a dot-net.&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;__:&lt;/span&gt; https://www.example.com&lt;span class="w"&gt;
&lt;/span&gt;__ https://www.example.net
&lt;/pre&gt;
&lt;p&gt;Rendered:&lt;/p&gt;
&lt;blockquote&gt;
&lt;a class="reference external" href="https://www.example.com"&gt;This link&lt;/a&gt; goes to a dot-com.  &lt;a class="reference external" href="https://www.example.net"&gt;This other link&lt;/a&gt; goes to a dot-net.&lt;/blockquote&gt;
&lt;p&gt;Write the link text as a &lt;a class="reference internal" href="#named-hyperlink-reference"&gt;named hyperlink reference&lt;/a&gt;, but instead of ending it
with one underscore, use two.  (As with named hyperlink references, the
backticks can be omitted for a &lt;a class="reference internal" href="#simple-reference-name"&gt;simple reference name&lt;/a&gt;.) Then, for the
&lt;a class="reference internal" href="#target"&gt;hyperlink target&lt;/a&gt;, use an underscore in place of the reference name
(so that you have two underscores in a row); alternatively, the entire
hyperlink target can be written as just two underscores, whitespace, and the
URI or e-mail address.&lt;/p&gt;
&lt;p&gt;The first anonymous hyperlink in a document will link to the URI given by the
first anonymous hyperlink target, the second anonymous hyperlink will link to
the second anonymous target, etc.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="embedded-uri-hyperlinks-and-automatic-reference-names"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Embedded URI Hyperlinks and Automatic Reference Names&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Here’s an interesting fact about &lt;a class="reference internal" href="#embedded-uri-hyperlinks"&gt;embedded URI hyperlinks&lt;/a&gt;: they’re equivalent
to a &lt;a class="reference internal" href="#named-hyperlink-reference"&gt;named hyperlink reference&lt;/a&gt; using the link text as the reference name.
That means this:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
&lt;span class="s"&gt;`This website &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;https://www.example.com&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt; is awesome!
&lt;/pre&gt;
&lt;p&gt;is exactly equivalent to:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
&lt;span class="s"&gt;`This website`_&lt;/span&gt; is awesome!&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_This website:&lt;/span&gt; https://www.example.com
&lt;/pre&gt;
&lt;p&gt;As a consequence of this, you can link to the same location as an embedded URI
link by using its link text as the reference name:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
I changed my mind; &lt;span class="s"&gt;`this website &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;https://www.example.com&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt; sucks.  Let me&lt;span class="w"&gt;
&lt;/span&gt;reiterate: The website at &lt;span class="s"&gt;`this link &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;this website_&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt; is nothing special.
&lt;/pre&gt;
&lt;div class="section" id="gotcha-duplicate-link-text"&gt;
&lt;span id="gotcha"&gt;&lt;/span&gt;&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Gotcha: Duplicate Link Text&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;As stated above, if a reference name is associated with two different URIs,
rendering the document will produce a warning, and the reference name will be
unusable in hyperlinks.  So what happens if we define two embedded URI
hyperlinks with the same link text but different URIs, like so?&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
See &lt;span class="s"&gt;`here &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;https://www.example.com&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt; and &lt;span class="s"&gt;`here &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;https://www.example.net&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;for more information.
&lt;/pre&gt;
&lt;p&gt;With the above input, a warning will be produced, but the hyperlinks will still
point where you want them to, and the reference name &lt;tt class="docutils literal"&gt;here&lt;/tt&gt; will refer to the
first URI.  This normally isn’t all that bad, but if you’re using a renderer
that fails on warnings — e.g., if you’re uploading a project with a
reStructuredText README to the &lt;a class="reference external" href="https://pypi.org"&gt;Python Package Index&lt;/a&gt; — the
rendering will fail, and your upload to PyPI will either be rejected or end up
with an unrendered project description.&lt;/p&gt;
&lt;p&gt;So how do we cleanly write embedded URI links with the same link text but
different URIs?  Answer: We add an extra underscore to the end of the link,
turning it into an &lt;a class="reference internal" href="#anon"&gt;anonymous hyperlink&lt;/a&gt;.&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
See &lt;span class="s"&gt;`here &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;https://www.example.com&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`__&lt;/span&gt; and `here&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;https://www.example.net&amp;gt;&lt;/span&gt;`__ for more information.
&lt;/pre&gt;
&lt;p&gt;With two underscores, no hyperlink target is created, and so there is no
conflict.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="embedded-alias-hyperlinks-and-automatic-reference-names"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Embedded Alias Hyperlinks and Automatic Reference Names&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Similarly to embedded URI hyperlinks, using an &lt;a class="reference internal" href="#embedded-alias"&gt;embedded alias hyperlink&lt;/a&gt; turns the link text into a reference name pointing at the
same location as the hyperlink reference.  The following markup defines four
hyperlinks that all point to &amp;lt;&lt;a class="reference external" href="https://www.example.com"&gt;https://www.example.com&lt;/a&gt;&amp;gt;:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
See &lt;span class="s"&gt;`this site &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;site_&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt; for more information.&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_site:&lt;/span&gt; https://www.example.com&lt;span class="w"&gt;

&lt;/span&gt;Now that I've written that link, I can write these links: `Click me! &amp;lt;this&lt;span class="w"&gt;
&lt;/span&gt;site_&amp;gt;&lt;span class="s"&gt;`_  I link to `this site`_&lt;/span&gt;!  &lt;span class="s"&gt;`Click me!`_&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;If you define multiple embedded alias hyperlinks with the same link text but
different hyperlink references, the document will render without any warnings,
and the link text will be usable as a reference name pointing to the same
location as the first hyperlink reference.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="intra-document-links"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Intra-Document Links&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Linking to different parts of the same document is accomplished using &lt;a class="reference internal" href="#embedded-alias"&gt;embedded
alias hyperlinks&lt;/a&gt; and &lt;a class="reference internal" href="#named-hyperlink-references"&gt;named hyperlink references&lt;/a&gt;, just
like external links; the difference is in how the &lt;a class="reference internal" href="#target"&gt;hyperlink target&lt;/a&gt;
is defined.&lt;/p&gt;
&lt;div class="section" id="internal-hyperlink-targets"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Internal Hyperlink Targets&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A hyperlink target without a URI creates an &lt;em&gt;internal hyperlink target&lt;/em&gt; that
points to the next element in the document after the target.&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Click &lt;span class="s"&gt;`here &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;After Lorem_&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt; to skip the next paragraph.&lt;span class="w"&gt;

&lt;/span&gt;Lorem ipsum dolor sit amet …&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_After Lorem:&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;This paragraph can be linked to with the reference name &amp;quot;&lt;span class="s"&gt;``After Lorem``&lt;/span&gt;.&amp;quot;&lt;span class="w"&gt;
&lt;/span&gt;Aren't you glad you didn't skip the previous paragraph now?
&lt;/pre&gt;
&lt;p&gt;Rendered:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Click &lt;a class="reference internal" href="#after-lorem"&gt;here&lt;/a&gt; to skip the next paragraph.&lt;/p&gt;
&lt;p&gt;Lorem ipsum dolor sit amet …&lt;/p&gt;
&lt;p id="after-lorem"&gt;This paragraph can be linked to with the reference name “&lt;tt class="docutils literal"&gt;After Lorem&lt;/tt&gt;.”
Aren’t you glad you didn’t skip the previous paragraph now?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The target points to the next element even if the target is indented so as to
be “nested” at the end of an indented block.  This allows us to attach targets
to individual elements of a list:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
&lt;span class="m"&gt;1.&lt;/span&gt; Any following lines that line up with &amp;quot;Any&amp;quot; belong to this list item.&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;   ..&lt;/span&gt; &lt;span class="nt"&gt;_item2:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;
&lt;span class="m"&gt;2.&lt;/span&gt; This list item can be linked to with the reference name &lt;span class="s"&gt;``item2``&lt;/span&gt;.
&lt;/pre&gt;
&lt;p&gt;If the &lt;tt class="docutils literal"&gt;.. _item2:&lt;/tt&gt; line above wasn’t indented, it would split the list into
two lists, and the target would point to the second list.  (A target before a
list always points to the list as a whole; a target pointing to just the first
item is not possible.)&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="named-directives"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Named Directives&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Most reStructuredText directives support a &lt;tt class="docutils literal"&gt;:name:&lt;/tt&gt; option that takes a
string as an argument.  Setting this option allows you to link to the directive
using that name, equivalent to preceding the directive with an internal
hyperlink target.&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="ow"&gt;danger&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;    &lt;span class="nc"&gt;:name:&lt;/span&gt; dont-or-whatever&lt;span class="w"&gt;

&lt;/span&gt;    Don't stick your finger in the— You know what?  Forget it.  I'm not&lt;span class="w"&gt;
&lt;/span&gt;    your mother.&lt;span class="w"&gt;

&lt;/span&gt;… Text passes …&lt;span class="w"&gt;

&lt;/span&gt;Hey, remember &lt;span class="s"&gt;`that admonition from earlier &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;dont-or-whatever_&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt;?  I was&lt;span class="w"&gt;
&lt;/span&gt;serious.
&lt;/pre&gt;
&lt;p&gt;Rendered:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div class="admonition danger" id="dont-or-whatever"&gt;
&lt;p class="first admonition-title"&gt;!DANGER!&lt;/p&gt;
&lt;p class="last"&gt;Don’t stick your finger in the— You know what?  Forget it.  I’m not
your mother.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;… Text passes …&lt;/p&gt;
&lt;p&gt;Hey, remember &lt;a class="reference internal" href="#dont-or-whatever"&gt;that admonition from earlier&lt;/a&gt;?  I was
serious.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As this is the same as using an internal hyperlink target, a warning will be
generated if two directives have the same name or if the name of a directive is
the same as a reference name of another hyperlink target.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="inline-internal-targets"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Inline Internal Targets&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A phrase within a paragraph of text can be made into a target by preceding the
phrase with an underscore and a backtick, escaping any backticks inside the
phrase, and appending a backtick to the end of the phrase.  (The backticks
cannot be omitted, no matter how simple the phrase is.)  This defines the
phrase itself as a reference name that points to the phrase’s location in the
document.&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
They're called &amp;quot;paragraphs,&amp;quot; but I've never seen them _&lt;span class="nv"&gt;`para`&lt;/span&gt;!  Know what I&lt;span class="w"&gt;
&lt;/span&gt;mean?&lt;span class="w"&gt;

&lt;/span&gt;(I don't know what I was saying &lt;span class="s"&gt;`here &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;para_&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt;.)
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="implicit-hyperlink-targets-for-section-titles"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="#contents"&gt;Implicit Hyperlink Targets for Section Titles&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A section title in a reStructuredText document implicitly defines a hyperlink
target pointing to that section with the same reference name as the section
title.&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Go read &amp;quot;&lt;span class="s"&gt;`All About Eels`_&lt;/span&gt;&amp;quot; to learn about our wriggly friends!&lt;span class="w"&gt;

&lt;/span&gt;Didn't you hear me?  Who wouldn't want to click `this link &amp;lt;All About&lt;span class="w"&gt;
&lt;/span&gt;Eels_&amp;gt;`_?&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="gh"&gt;All About Eels&lt;/span&gt;
&lt;span class="gh"&gt;==============&lt;/span&gt;
Did you know?  When you're bit in the heel by a big giant eel, that's a&lt;span class="w"&gt;
&lt;/span&gt;moray.
&lt;/pre&gt;
&lt;p&gt;If a section has the same name as a hyperlink target or a directive, the
hyperlink target or directive takes precedence, and the section cannot be
linked to by name.  If two or more sections have the same name, none of them
can be linked to by name.  In order to link to a section that cannot be linked
by name, you must precede the section title with an internal hyperlink target
and link to that.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="chaining-hyperlink-targets"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Chaining Hyperlink Targets&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It’s possible to define multiple hyperlink targets all pointing to the same
location by “chaining” the targets together, one after the other:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_foo:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_bar:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_baz:&lt;/span&gt; https://www.example.com&lt;span class="w"&gt;

&lt;/span&gt;Now the reference names foo_, bar_, and baz_ all link to the same place.
&lt;/pre&gt;
&lt;p&gt;Chained hyperlink targets all point to the same location as the last target in
the chain.  If the last target is an internal hyperlink target, the chained
targets will all point to the same document element as that last target:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_foo:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_bar:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_baz:&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;Now the reference names foo_, bar_, and baz_ all link to this paragraph.
&lt;/pre&gt;
&lt;p id="indirect-hyperlink-target"&gt;Alternatively, a hyperlink target &lt;tt class="docutils literal"&gt;A&lt;/tt&gt; can be defined to point to the same
location as another target &lt;tt class="docutils literal"&gt;B&lt;/tt&gt; by defining the hyperlink target with &lt;tt class="docutils literal"&gt;B&lt;/tt&gt;
(as a named hyperlink reference) in place of the URI:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_some link:&lt;/span&gt; https://www.example.com&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_foo:&lt;/span&gt; &lt;span class="s"&gt;`some link`_&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;Now &lt;span class="s"&gt;`some link`_&lt;/span&gt; and foo_ go to the same website.
&lt;/pre&gt;
&lt;p&gt;The &lt;tt class="docutils literal"&gt;.. _foo:&lt;/tt&gt; definition is called an &lt;em&gt;indirect hyperlink target&lt;/em&gt;.  As with
named hyperlink references, the backticks can be dropped when the hyperlink
reference is a &lt;a class="reference internal" href="#simple-reference-name"&gt;simple reference name&lt;/a&gt;.  &lt;a class="reference internal" href="#multiline"&gt;As with external hyperlink targets&lt;/a&gt;, the hyperlink reference may begin on the same or next line as
the target, and it may span multiple lines.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="styling-link-text"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Styling Link Text&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As you may have noticed, inline markup in link text is treated literally rather
than being processed into emphasis etc.  For example, this:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Try this recipe for &lt;span class="s"&gt;`pie *à la mode* &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;https://www.example.com&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt;.
&lt;/pre&gt;
&lt;p&gt;renders as:&lt;/p&gt;
&lt;blockquote&gt;
Try this recipe for &lt;a class="reference external" href="https://www.example.com"&gt;pie *à la mode*&lt;/a&gt;.&lt;/blockquote&gt;
&lt;p&gt;The asterisks are rendered as-is instead of causing the “à la mode” to be
emphasized.&lt;/p&gt;
&lt;p&gt;Fortunately, there’s a trick to use inline markup in link text: Define the link
using a substitution:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Try this recipe for |pie à la mode|_.&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;|pie à la mode|&lt;/span&gt; &lt;span class="ow"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt; pie &lt;span class="ge"&gt;*à la mode*&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_pie à la mode:&lt;/span&gt; https://www.example.com
&lt;/pre&gt;
&lt;p&gt;Rendered:&lt;/p&gt;
&lt;blockquote&gt;
Try this recipe for &lt;a class="reference external" href="https://www.example.com"&gt;pie &lt;em&gt;à la mode&lt;/em&gt;&lt;/a&gt;.&lt;/blockquote&gt;
&lt;p&gt;The steps to do this are as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;In our text, we insert a &lt;em&gt;substitution reference&lt;/em&gt; where we want the link to
be.  A substitution reference consists of a vertical bar, some arbitrary
substitution text, and another vertical bar.  Because we also want this to be
a hyperlink, an underscore is added after the closing vertical bar, causing
the substitution reference to also be a &lt;a class="reference internal" href="#named-hyperlink-reference"&gt;named hyperlink reference&lt;/a&gt; with the
substitution text as the reference name.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;The substitution text can be any text that does not begin or end with
whitespace.  Substitution text is matched case-sensitively, but if that
fails, a case-insensitive match is tried.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Elsewhere in the document, a &lt;em&gt;substitution definition&lt;/em&gt; is given for the
substitution reference: two periods, a space, a vertical bar, the same
substitution text as in the substitution reference, another vertical bar,
whitespace, a &lt;tt class="docutils literal"&gt;replace::&lt;/tt&gt; directive (without leading &lt;tt class="docutils literal"&gt;..&lt;/tt&gt;), whitespace,
and then finally the inline markup to display in place of the substitution
reference in the rendered document.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Elsewhere in the document, a &lt;a class="reference internal" href="#target"&gt;hyperlink target&lt;/a&gt; is created that
maps the substitution text to the URI or e-mail address that the substituted
text should link to.  To link to a location in the document rather than to an
external URI, either use an &lt;a class="reference internal" href="#indirect-hyperlink-target"&gt;indirect hyperlink target&lt;/a&gt;:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Try this recipe for |pie à la mode|_.&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;|pie à la mode|&lt;/span&gt; &lt;span class="ow"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt; pie &lt;span class="ge"&gt;*à la mode*&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_pie à la mode:&lt;/span&gt; &lt;span class="s"&gt;`pie recipe`_&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;Some intervening text&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_pie recipe:&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;So here's how you make pie &lt;span class="ge"&gt;*à la mode*&lt;/span&gt;: …
&lt;/pre&gt;
&lt;p&gt;or else make the substitution text the same as the reference name of the
internal target:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
Try this recipe for |pie recipe|_.&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;|pie recipe|&lt;/span&gt; &lt;span class="ow"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt; pie &lt;span class="ge"&gt;*à la mode*&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;Some intervening text&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_pie recipe:&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;So here's how you make pie &lt;span class="ge"&gt;*à la mode*&lt;/span&gt;: …
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If desired, the substitution reference can be made into an &lt;a class="reference internal" href="#anon"&gt;anonymous
hyperlink&lt;/a&gt; instead by placing two underscores instead of one after the closing
vertical bar, in which case the hyperlink target must follow the anonymous
hyperlink target syntax.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="link-text-within-a-word"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Link Text within a Word&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Normally, a hyperlink spans one or more full words, but what if we want to only
link part of a word?  To do so, we must insert a backslash (optionally followed
by a whitespace character) between the link and the rest of the word:&lt;/p&gt;
&lt;pre class="code rst literal-block"&gt;
These &lt;span class="s"&gt;`link &lt;/span&gt;&lt;span class="si"&gt;&amp;lt;https://www.example.com&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;`_&lt;/span&gt;\s are getting out of control!  Now&lt;span class="w"&gt;
&lt;/span&gt;they're in the in\ test_\ ines of our words.&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="nt"&gt;_test:&lt;/span&gt; https://www.example.net
&lt;/pre&gt;
&lt;p&gt;This renders as:&lt;/p&gt;
&lt;blockquote&gt;
These &lt;a class="reference external" href="https://www.example.com"&gt;link&lt;/a&gt;s are getting out of control!  Now
they’re in the in&lt;a class="reference external" href="https://www.example.net"&gt;test&lt;/a&gt;ines of our words.&lt;/blockquote&gt;
&lt;/div&gt;
</content><category term="Software"></category><category term="markup"></category><category term="reStructuredText"></category></entry><entry><title>Unicode and LaTeX</title><link href="https://jwodder.github.io/kbits/posts/unicode-latex/" rel="alternate"></link><published>2020-07-27T00:00:00-04:00</published><updated>2020-07-27T00:00:00-04:00</updated><author><name>John T. Wodder II</name></author><id>tag:jwodder.github.io,2020-07-27:/kbits/posts/unicode-latex/</id><summary type="html">&lt;p class="first last"&gt;How to configure LaTeX to accept UTF-8 input (or just use XeLaTeX/LuaLaTeX
instead)&lt;/p&gt;
</summary><content type="html">&lt;p&gt;LaTeX is a powerful document typesetting system, but (especially if you’re
using a version even a few years old), getting it to accept and display
non-ASCII characters natively requires knowledge squirreled away in scattered
documents.  Here we cover how to get LaTeX to work with UTF-8 input characters
in hopes of thwarting the squirrels of obscurity.&lt;/p&gt;
&lt;p&gt;Or you could just &lt;a class="reference internal" href="#xetex-and-luatex"&gt;skip all that&lt;/a&gt; and use XeLaTeX or
LuaLaTeX instead.&lt;/p&gt;
&lt;div class="section" id="pdftex-engine-pdflatex"&gt;
&lt;h2&gt;pdfTeX Engine (pdfLaTeX)&lt;/h2&gt;
&lt;p&gt;When using “basic” LaTeX with the pdfTeX engine, enabling UTF-8 input requires
simply placing the following commands at the top of your document preamble:&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[T1]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;fontenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[utf8]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;inputenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;The exact effects of these commands are as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;code class="tx tex"&gt;&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[T1]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;fontenc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;/code&gt; sets the output font encoding to &lt;a class="reference external" href="http://www.micropress-inc.com/fonts/encoding/t1.htm"&gt;T1&lt;/a&gt;.  A font
encoding is a mapping between character codes and glyphs in a font; the font
encodings defined by LaTeX are described in &lt;a class="footnote-reference" href="#encguide" id="footnote-reference-1"&gt;[4]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By default, LaTeX uses the &lt;a class="reference external" href="http://www.micropress-inc.com/fonts/encoding/ot1.htm"&gt;OT1&lt;/a&gt; font encoding, a 7-bit encoding in which
accented characters like “ö” are formed by adding an accent glyph to the base
letter.  T1, by contrast, is an 8-bit encoding supporting widespread European
languages in which many letter+accent combinations exist as single glyphs.
&lt;a class="footnote-reference" href="#fontenc-vs-inputenc" id="footnote-reference-2"&gt;[3]&lt;/a&gt; &lt;a class="footnote-reference" href="#use-fontenc" id="footnote-reference-3"&gt;[14]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Without this command, characters will be represented using what’s available
in OT1, and, as a result, words containing accented characters won’t be
correctly hyphenated, copying-and-pasting accented characters from a built
PDF won’t work correctly, and inputting a &lt;tt class="docutils literal"&gt;|&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;&amp;lt;&lt;/tt&gt;, or &lt;tt class="docutils literal"&gt;&amp;gt;&lt;/tt&gt; will produce
a completely different character in the resulting PDF. &lt;a class="footnote-reference" href="#use-fontenc" id="footnote-reference-4"&gt;[14]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If one passes a comma-separated list of font encodings to the &lt;tt class="docutils literal"&gt;fontenc&lt;/tt&gt;
package, the last encoding in the list becomes the document’s default
encoding, and switching to the other encodings (e.g., in order to enter
characters only defined by those encodings) becomes possible using the
command sequence &lt;code class="tx tex"&gt;&lt;span class="k"&gt;\fontencoding&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;INSERT ENCODING NAME HERE&lt;span class="nb"&gt;}&lt;/span&gt; &lt;span class="k"&gt;\selectfont&lt;/span&gt;&lt;/code&gt;.
&lt;a class="footnote-reference" href="#source2e" id="footnote-reference-5"&gt;[6]&lt;/a&gt; &lt;a class="footnote-reference" href="#minimal" id="footnote-reference-6"&gt;[13]&lt;/a&gt; &lt;a class="footnote-reference" href="#latex2e-unoff" id="footnote-reference-7"&gt;[9]&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;code class="tx tex"&gt;&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[utf8]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;inputenc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;/code&gt; sets the input encoding for the document
source to UTF-8, allowing UTF-8 characters to appear in the input document.
Additionally, for each font encoding used in the document, &lt;tt class="docutils literal"&gt;inputenc&lt;/tt&gt; loads
a mapping of UTF-8 characters to commands usable in that font encoding.
&lt;a class="footnote-reference" href="#inputenc" id="footnote-reference-8"&gt;[1]&lt;/a&gt;  When paired with the &lt;tt class="docutils literal"&gt;fontenc&lt;/tt&gt; command above, on recent LaTeX
versions, &lt;tt class="docutils literal"&gt;inputenc&lt;/tt&gt; loads mappings from the files &lt;tt class="docutils literal"&gt;omsenc.dfu&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;ot1enc.dfu&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;t1enc.dfu&lt;/tt&gt;, and &lt;tt class="docutils literal"&gt;ts1enc.dfu&lt;/tt&gt; &lt;a class="footnote-reference" href="#minimal" id="footnote-reference-9"&gt;[13]&lt;/a&gt;, located in
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;$TEXDIR/texmf-dist/tex/latex/base&lt;/span&gt;&lt;/tt&gt; in an installed TeX Live distribution;
this in turn allows the user to input any of the characters mapped by those
files into a document and have the characters be typeset appropriately.&lt;/p&gt;
&lt;p&gt;Without this command, older versions of LaTeX will use a “raw” input encoding
in which each input byte is typeset as the glyph in the same position in the
current font. &lt;a class="footnote-reference" href="#ltnews28" id="footnote-reference-10"&gt;[8]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Beginning with the 2018-04-01 release, LaTeX uses UTF-8 as the default
encoding for source files, making &lt;code class="tx tex"&gt;&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[utf8]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;inputenc&lt;span class="nb"&gt;}&lt;/span&gt;&lt;/code&gt;
redundant. &lt;a class="footnote-reference" href="#ltnews28" id="footnote-reference-11"&gt;[8]&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once the above commands are added to your document preamble, you will be able
to enter a number of UTF-8 characters directly into your document and have them
show up in the built PDF without having to type out their commands.  You’ll
even be able to write smart quotes (&lt;tt class="docutils literal"&gt;“&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;”&lt;/tt&gt;) directly instead of typing
quotes out as `` and &lt;tt class="docutils literal"&gt;''&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;So instead of writing this:&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
``My na&lt;span class="k"&gt;\&amp;quot;\i&lt;/span&gt;&lt;span class="nb"&gt;{}&lt;/span&gt;ve r&lt;span class="k"&gt;\'&lt;/span&gt;esum&lt;span class="k"&gt;\'&lt;/span&gt;e is attached.''  --- Se&lt;span class="k"&gt;\~&lt;/span&gt;nor &lt;span class="k"&gt;\TH&lt;/span&gt;&lt;span class="nb"&gt;{}&lt;/span&gt;or
&lt;/pre&gt;
&lt;p&gt;you can write this:&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
“My naïve résumé is attached.”  — Señor Þor
&lt;/pre&gt;
&lt;p&gt;and LaTeX will handle the input correctly.&lt;/p&gt;
&lt;p&gt;Note that LaTeX does not support combining characters; input must be in a
composed form.&lt;/p&gt;
&lt;p&gt;If LaTeX encounters a Unicode character that it doesn’t have a definition for,
typesetting will stop with an error message of the form:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
! Package inputenc Error: Unicode char ☃ (U+2603)
(inputenc)                not set up for use with LaTeX.
&lt;/pre&gt;
&lt;p&gt;If you want to use a certain character in your document that LaTeX doesn’t
recognize, you can use the &lt;code class="tx tex"&gt;&lt;span class="k"&gt;\DeclareUnicodeCharacter&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;hexcode&lt;span class="nb"&gt;}{&lt;/span&gt;cmd&lt;span class="nb"&gt;}&lt;/span&gt;&lt;/code&gt; command
provided by &lt;tt class="docutils literal"&gt;inputenc&lt;/tt&gt;.  Its first argument is the hexadecimal code point of
the Unicode character to define, and the second argument is the LaTeX command
to execute when the character is encountered. &lt;a class="footnote-reference" href="#inputenc" id="footnote-reference-12"&gt;[1]&lt;/a&gt;  For example:&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;tikzsymbols&lt;span class="nb"&gt;}&lt;/span&gt;  &lt;span class="c"&gt;% provides \Snowman
&lt;/span&gt;&lt;span class="k"&gt;\DeclareUnicodeCharacter&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;2603&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="k"&gt;\Snowman&lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;% Now you can put ☃ in your document!&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;If you don’t want to have to enter characters as codepoints, the
&lt;code class="tx tex"&gt;&lt;span class="k"&gt;\newunicodechar&lt;/span&gt;&lt;/code&gt; command provided by &lt;a class="reference external" href="https://ctan.org/pkg/newunicodechar"&gt;the newunicodechar package&lt;/a&gt; lets you use the character itself
instead, &lt;a class="footnote-reference" href="#newunicodechar-docs" id="footnote-reference-13"&gt;[2]&lt;/a&gt; allowing us to rewrite the example above as:&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;newunicodechar&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;tikzsymbols&lt;span class="nb"&gt;}&lt;/span&gt;  &lt;span class="c"&gt;% provides \Snowman
&lt;/span&gt;&lt;span class="k"&gt;\newunicodechar&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;☃&lt;span class="nb"&gt;}{&lt;/span&gt;&lt;span class="k"&gt;\Snowman&lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;% Now you can put ☃ in your document!&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;As a special case, loading the &lt;tt class="docutils literal"&gt;textcomp&lt;/tt&gt; package lets you input all of the
Unicode characters that can be output with &lt;tt class="docutils literal"&gt;textcomp&lt;/tt&gt;’s commands; for
example, &lt;tt class="docutils literal"&gt;textcomp&lt;/tt&gt; defines a &lt;code class="tx tex"&gt;&lt;span class="k"&gt;\textmusicalnote&lt;/span&gt;&lt;/code&gt; command that produces ♪
(U+266A, EIGHTH NOTE), and so including &lt;tt class="docutils literal"&gt;textcomp&lt;/tt&gt; in your preamble allows
you to write “♪” in your document and have it be treated as the
&lt;code class="tx tex"&gt;&lt;span class="k"&gt;\textmusicalnote&lt;/span&gt;&lt;/code&gt; command, producing a “♪” in the output.&lt;/p&gt;
&lt;div class="section" id="non-latin-alphabets"&gt;
&lt;h3&gt;Non-Latin Alphabets&lt;/h3&gt;
&lt;p&gt;The commands described so far only provide meaningful support for text in
Latin-derived alphabets.  In order to enter text in other alphabets, more
elaborate steps are required.&lt;/p&gt;
&lt;div class="section" id="cyrillic-alphabet"&gt;
&lt;h4&gt;Cyrillic Alphabet&lt;/h4&gt;
&lt;p&gt;The most direct way to enable Cyrillic input is to specify a Cyrillic font
encoding in the &lt;tt class="docutils literal"&gt;fontenc&lt;/tt&gt; command.  Due to the large number of Cyrillic
characters in existence, the script is split up into three font encodings (T2A,
T2B, and T2C) that each match up with the T1 encoding in the lower 7-bit range,
plus a fourth encoding, X2, that contains all of the Cyrillic characters but is
not compatible with T1. &lt;a class="footnote-reference" href="#encguide" id="footnote-reference-14"&gt;[4]&lt;/a&gt; &lt;a class="footnote-reference" href="#cyrguide" id="footnote-reference-15"&gt;[11]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A purely-Cyrillic document can be written with the X2 font encoding as follows:&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
&lt;span class="k"&gt;\documentclass&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;article&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[X2]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;fontenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[utf8]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;inputenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
Пролетарии всех стран, соединяйтесь!
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;If you want to use both Cyrillic and Latin characters in your document, you
need to pass both T1 and X2 to &lt;tt class="docutils literal"&gt;fontenc&lt;/tt&gt;.  Whichever one is listed last in
the &lt;tt class="docutils literal"&gt;fontenc&lt;/tt&gt; command becomes the default font encoding for the document; the
other font encoding can be switched to by writing &lt;code class="tx tex"&gt;&lt;span class="k"&gt;\fontencoding&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;INSERT
ENCODING NAME HERE&lt;span class="nb"&gt;}&lt;/span&gt; &lt;span class="k"&gt;\selectfont&lt;/span&gt;&lt;/code&gt;. &lt;a class="footnote-reference" href="#source2e" id="footnote-reference-16"&gt;[6]&lt;/a&gt; &lt;a class="footnote-reference" href="#minimal" id="footnote-reference-17"&gt;[13]&lt;/a&gt; &lt;a class="footnote-reference" href="#latex2e-unoff" id="footnote-reference-18"&gt;[9]&lt;/a&gt;
For example:&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
&lt;span class="k"&gt;\documentclass&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;article&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[X2,T1]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;fontenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[utf8]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;inputenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
“&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\fontencoding&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;X2&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\selectfont&lt;/span&gt; Пролетарии всех стран, соединяйтесь!&lt;span class="nb"&gt;}&lt;/span&gt;” said
Señor Þor.
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;Managing encodings this way can get annoying; fortunately, &lt;a class="reference external" href="https://ctan.org/pkg/babel"&gt;the babel package&lt;/a&gt; provides a better way.  Add a
&lt;code class="tx tex"&gt;&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[LANGUAGES]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;babel&lt;span class="nb"&gt;}&lt;/span&gt;&lt;/code&gt; command to your preamble, where
&lt;tt class="docutils literal"&gt;LANGUAGES&lt;/tt&gt; is replaced by a comma-separated list of the languages that will
be used in your document; the last language in the list will become the
document’s default language.  Within the document, the language can be changed
with &lt;code class="tx tex"&gt;&lt;span class="k"&gt;\selectlanguage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;LANGUAGE&lt;span class="nb"&gt;}&lt;/span&gt;&lt;/code&gt; (though, for short passages, it’s better
to use &lt;code class="tx tex"&gt;&lt;span class="k"&gt;\foreignlanguage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;LANGUAGE&lt;span class="nb"&gt;}{&lt;/span&gt;TEXT&lt;span class="nb"&gt;}&lt;/span&gt;&lt;/code&gt;), and when it’s set to a
Cyrillic-using language, you can write in Cyrillic. &lt;a class="footnote-reference" href="#babel" id="footnote-reference-19"&gt;[7]&lt;/a&gt; &lt;a class="footnote-reference" href="#cyrguide" id="footnote-reference-20"&gt;[11]&lt;/a&gt;  For
example:&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
&lt;span class="k"&gt;\documentclass&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;article&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;% If we don't explicitly load a Cyrillic font encoding, babel emits a
% warning and defaults to loading T2A.
&lt;/span&gt;&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[T2A,T1]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;fontenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[utf8]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;inputenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[russian,english]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;babel&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
“&lt;span class="k"&gt;\foreignlanguage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;russian&lt;span class="nb"&gt;}{&lt;/span&gt;Пролетарии всех стран, соединяйтесь!&lt;span class="nb"&gt;}&lt;/span&gt;” said
Señor Þor.
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="greek-alphabet"&gt;
&lt;h4&gt;Greek Alphabet&lt;/h4&gt;
&lt;p&gt;As with Cyrillic, entering Greek in LaTeX requires setting the font encoding,
in this case to LGR: &lt;a class="footnote-reference" href="#encguide" id="footnote-reference-21"&gt;[4]&lt;/a&gt;&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
&lt;span class="k"&gt;\documentclass&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;article&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[LGR,T1]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;fontenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[utf8]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;inputenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
“&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\fontencoding&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;LGR&lt;span class="nb"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\selectfont&lt;/span&gt; Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς
μάλα πολλὰ&lt;span class="nb"&gt;}&lt;/span&gt;” said Homer.

“Is he talking about me?” wondered Señor Þor.
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;As before, we can let also choose to let babel take care of the encodings for
us:&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
&lt;span class="k"&gt;\documentclass&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;article&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;% No need to explicitly load LGR!
&lt;/span&gt;&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[T1]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;fontenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[utf8]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;inputenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[greek,english]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;babel&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
“&lt;span class="k"&gt;\foreignlanguage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;greek&lt;span class="nb"&gt;}{&lt;/span&gt;Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα
πολλὰ&lt;span class="nb"&gt;}&lt;/span&gt;” said Homer.

“Is he talking about me?” wondered Señor Þor.
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;As another alternative, &lt;a class="reference external" href="https://ctan.org/pkg/greek-fontenc"&gt;the greek-fontenc package&lt;/a&gt; provides a &lt;tt class="docutils literal"&gt;textalpha&lt;/tt&gt; package that
allows one to write Greek directly without the need for babel or
language-switching: &lt;a class="footnote-reference" href="#greek-utf8" id="footnote-reference-22"&gt;[5]&lt;/a&gt;&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
&lt;span class="k"&gt;\documentclass&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;article&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[T1]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;fontenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[utf8]&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;inputenc&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;textalpha&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\begin&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
“Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ” said Homer.

“Is he talking about me?” wondered Señor Þor.
&lt;span class="k"&gt;\end&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;document&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;greek-fontenc also provides an &lt;tt class="docutils literal"&gt;alphabeta&lt;/tt&gt; package that lets one use Greek
characters directly in math mode. &lt;a class="footnote-reference" href="#greek-utf8" id="footnote-reference-23"&gt;[5]&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="other-alphabets"&gt;
&lt;h4&gt;Other Alphabets&lt;/h4&gt;
&lt;p&gt;LaTeX’s built-in font encodings only cover Latin, Cyrillic, and Greek.
Enabling input in other alphabets is a separate topic for each alphabet with no
easy one-size-fits-all answer.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="xetex-engine-xelatex-and-luatex-engine-lualatex"&gt;
&lt;span id="xetex-and-luatex"&gt;&lt;/span&gt;&lt;h2&gt;XeTeX Engine (XeLaTeX) and LuaTeX Engine (LuaLaTeX)&lt;/h2&gt;
&lt;p&gt;Besides pdfTeX, LaTeX can also run on two major alternative engines:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference external" href="http://xetex.sourceforge.net"&gt;The XeTeX engine&lt;/a&gt;, on which LaTeX runs as
XeLaTeX&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;a class="reference external" href="http://www.luatex.org"&gt;The LuaTeX engine&lt;/a&gt;, on which LaTeX runs as
LuaLaTeX.  This is a TeX engine with an embedded interpreter for &lt;a class="reference external" href="http://www.lua.org"&gt;the Lua
programming language&lt;/a&gt; that allows developers to extend
the engine by coding in Lua. &lt;a class="footnote-reference" href="#faq-xelua" id="footnote-reference-24"&gt;[12]&lt;/a&gt; &lt;a class="footnote-reference" href="#wiki-luatex" id="footnote-reference-25"&gt;[15]&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Both engines fully support Unicode input and support modern font technologies,
including being able to use fonts from the operating system.  &lt;a class="footnote-reference" href="#xetex" id="footnote-reference-26"&gt;[16]&lt;/a&gt;
&lt;a class="footnote-reference" href="#faq-xelua" id="footnote-reference-27"&gt;[12]&lt;/a&gt;  When it comes to Unicode support, the major differences between
pdfLaTeX and XeLaTeX/LuaLaTeX are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;XeLaTeX and LuaLaTeX documents must always be written in UTF-8, while
pdfLaTeX accepts document in various input encodings. &lt;a class="footnote-reference" href="#lshort" id="footnote-reference-28"&gt;[10]&lt;/a&gt; &lt;a class="footnote-reference" href="#minimal" id="footnote-reference-29"&gt;[13]&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The &lt;tt class="docutils literal"&gt;fontenc&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;inputenc&lt;/tt&gt; commands used in pdfLaTeX should be omitted
when working with XeLaTeX/LuaLaTeX; the Unicode engines ignore (and give a
warning about) &lt;tt class="docutils literal"&gt;inputenc&lt;/tt&gt;, while setting &lt;tt class="docutils literal"&gt;fontenc&lt;/tt&gt; can actually cause
some characters (like smart quotes) to not be recognized.  Instead, you can
just start entering Unicode characters directly into your document without
having to include any packages.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;The set of available Unicode characters in XeLaTeX/LuaLaTeX is determined by
what characters are defined in the current font. &lt;a class="footnote-reference" href="#minimal" id="footnote-reference-30"&gt;[13]&lt;/a&gt;  The default
font in both XeLaTeX and LuaLaTeX is &lt;a class="reference external" href="http://www.gust.org.pl/projects/e-foundry/latin-modern"&gt;Latin Modern&lt;/a&gt;, a derivative of
TeX’s Computer Modern default font that adds many more characters.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;If XeLaTeX encounters a Unicode character that does not exist in the current
font, the resulting PDF will show the font’s placeholder character if it has
one; if the font has no placeholder character, nothing will be shown.  Either
way, the &lt;tt class="docutils literal"&gt;.log&lt;/tt&gt; file will contain a line of the form:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Missing character: There is no ☃ in font [lmroman10-regular]:mapping=tex-text;!
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;If LuaLaTeX encounters a Unicode character that does not exist in the current
font, the character will be omitted in the resulting PDF.  No warning will be
emitted or logged.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;code class="tx tex"&gt;&lt;span class="k"&gt;\DeclareUnicodeCharacter&lt;/span&gt;&lt;/code&gt; is not a valid command in XeLaTeX or LuaLaTeX;
one must instead write something like:&lt;/p&gt;
&lt;pre class="code latex literal-block"&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="nb"&gt;{&lt;/span&gt;tikzsymbols&lt;span class="nb"&gt;}&lt;/span&gt;  &lt;span class="c"&gt;% provides \Snowman
&lt;/span&gt;&lt;span class="k"&gt;\catcode&lt;/span&gt;`☃=&lt;span class="k"&gt;\active&lt;/span&gt;
&lt;span class="k"&gt;\protected\def&lt;/span&gt; ☃&lt;span class="nb"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\Snowman&lt;/span&gt;&lt;span class="nb"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;&lt;code class="tx tex"&gt;&lt;span class="k"&gt;\newunicodechar&lt;/span&gt;&lt;/code&gt; can still be used in place of this method, though.
&lt;a class="footnote-reference" href="#newunicodechar-docs" id="footnote-reference-31"&gt;[2]&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Being able to write in another alphabet is largely a matter of switching to a
font that supports that alphabet.  See &lt;a class="reference external" href="https://ctan.org/pkg/fontspec"&gt;the fontspec package&lt;/a&gt; for how to change fonts in XeLaTeX and
LuaLaTeX.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;While neither XeLaTeX nor LuaLaTeX natively supports combining characters,
the Lua scripting capabilities in the latter can be used to give combining
characters in your source code the desired effect; see
&amp;lt;&lt;a class="reference external" href="https://tex.stackexchange.com/a/149197"&gt;https://tex.stackexchange.com/a/149197&lt;/a&gt;&amp;gt; for an example.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="references"&gt;
&lt;h2&gt;References&lt;/h2&gt;
&lt;table class="docutils footnote" frame="void" id="inputenc" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[1]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-8"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-12"&gt;2&lt;/a&gt;)&lt;/em&gt; Alan Jeffrey and Frank Mittelbach,
&lt;cite&gt;inputenc.sty&lt;/cite&gt;.
Version 1.3c.
Last modified 2018 August 11,
&amp;lt;&lt;a class="reference external" href="http://mirrors.ctan.org/macros/latex/base/inputenc.pdf"&gt;http://mirrors.ctan.org/macros/latex/base/inputenc.pdf&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="newunicodechar-docs" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[2]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-13"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-31"&gt;2&lt;/a&gt;)&lt;/em&gt; Enrico Gregorio,
&lt;cite&gt;The newunicodechar package&lt;/cite&gt;.
Last modified 2018 April 8,
&amp;lt;&lt;a class="reference external" href="http://mirrors.ctan.org/macros/latex/contrib/newunicodechar/newunicodechar.pdf"&gt;http://mirrors.ctan.org/macros/latex/contrib/newunicodechar/newunicodechar.pdf&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="fontenc-vs-inputenc" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-2"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;“fontenc vs inputenc”,
&lt;cite&gt;TeX - LaTeX Stack Exchange&lt;/cite&gt;.
Last modified 2018 April 3,
&amp;lt;&lt;a class="reference external" href="https://tex.stackexchange.com/q/44694"&gt;https://tex.stackexchange.com/q/44694&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="encguide" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[4]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-1"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-14"&gt;2&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-21"&gt;3&lt;/a&gt;)&lt;/em&gt; Frank Mittelbach, Robin Fairbairns, Werner Lemberg, and LaTeX3 Project Team,
&lt;cite&gt;LaTeX font encodings&lt;/cite&gt;.
Last modified 2016 February 18,
&amp;lt;&lt;a class="reference external" href="https://www.latex-project.org/help/documentation/encguide.pdf"&gt;https://www.latex-project.org/help/documentation/encguide.pdf&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="greek-utf8" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[5]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-22"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-23"&gt;2&lt;/a&gt;)&lt;/em&gt; Günter Milde,
&lt;cite&gt;Greek Unicode with 8-bit TeX and inputenc&lt;/cite&gt;.
Last modified 2019 July 11,
&amp;lt;&lt;a class="reference external" href="http://mirrors.ctan.org/language/greek/greek-inputenc/greek-utf8.pdf"&gt;http://mirrors.ctan.org/language/greek/greek-inputenc/greek-utf8.pdf&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="source2e" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[6]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-5"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-16"&gt;2&lt;/a&gt;)&lt;/em&gt; Johannes Braams, David Carlisle, Alan Jeffrey, Leslie Lamport, Frank
Mittelbach, Chris Rowley, and Rainer Schöpf,
&lt;cite&gt;The LaTeX2e Sources&lt;/cite&gt;.
Last modified 2020 February 2,
&amp;lt;&lt;a class="reference external" href="http://mirrors.ibiblio.org/CTAN/macros/latex/base/source2e.pdf"&gt;http://mirrors.ibiblio.org/CTAN/macros/latex/base/source2e.pdf&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="babel" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-19"&gt;[7]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Johannes L. Braams and Javier Bezos,
&lt;cite&gt;Babel: Localization and internationalization&lt;/cite&gt;.
Version 3.47.
Last modified 2020 July 13,
&amp;lt;&lt;a class="reference external" href="http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf"&gt;http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="ltnews28" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[8]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-10"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-11"&gt;2&lt;/a&gt;)&lt;/em&gt; &lt;cite&gt;LaTeX News&lt;/cite&gt;, issue 28, 2018 April.
&amp;lt;&lt;a class="reference external" href="https://www.latex-project.org/news/latex2e-news/ltnews28.pdf"&gt;https://www.latex-project.org/news/latex2e-news/ltnews28.pdf&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="latex2e-unoff" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[9]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-7"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-18"&gt;2&lt;/a&gt;)&lt;/em&gt; &lt;cite&gt;LaTeX2e unofficial reference manual&lt;/cite&gt;.
Last modified 2018 October,
&amp;lt;&lt;a class="reference external" href="http://tug.org/texinfohtml/latex2e.html"&gt;http://tug.org/texinfohtml/latex2e.html&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="lshort" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-28"&gt;[10]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Tobias Oetiker, Hubert Partl, Irene Hyna, and Elisabeth Schlegl,
&lt;cite&gt;The Not So Short Introduction to LaTeX2ε&lt;/cite&gt;.
Version 6.2.
Last modified 2018 February 28,
&amp;lt;&lt;a class="reference external" href="http://tug.ctan.org/info/lshort/english/lshort.pdf"&gt;http://tug.ctan.org/info/lshort/english/lshort.pdf&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="cyrguide" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[11]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-15"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-20"&gt;2&lt;/a&gt;)&lt;/em&gt; Vladimir Volovich, Werner Lemberg, and LaTeX3 Project Team,
&lt;cite&gt;Cyrillic languages support in LaTeX&lt;/cite&gt;.
Last modified 1999 March 12,
&amp;lt;&lt;a class="reference external" href="https://www.latex-project.org/help/documentation/cyrguide.pdf"&gt;https://www.latex-project.org/help/documentation/cyrguide.pdf&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="faq-xelua" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[12]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-24"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-27"&gt;2&lt;/a&gt;)&lt;/em&gt; “What are XeTeX and LuaTeX?”,
&lt;cite&gt;The TeX Frequently Asked Question List&lt;/cite&gt;.
&amp;lt;&lt;a class="reference external" href="https://www.texfaq.org/FAQ-xetex-luatex"&gt;https://www.texfaq.org/FAQ-xetex-luatex&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="minimal" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[13]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-6"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-9"&gt;2&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-17"&gt;3&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-29"&gt;4&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-30"&gt;5&lt;/a&gt;)&lt;/em&gt; “What Unicode characters does pdfLaTeX support with a minimal preamble?”,
&lt;cite&gt;TeX - LaTeX Stack Exchange&lt;/cite&gt;.
Last modified 2020 July 27,
&amp;lt;&lt;a class="reference external" href="https://tex.stackexchange.com/q/555199"&gt;https://tex.stackexchange.com/q/555199&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="use-fontenc" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;[14]&lt;/td&gt;&lt;td&gt;&lt;em&gt;(&lt;a class="fn-backref" href="#footnote-reference-3"&gt;1&lt;/a&gt;, &lt;a class="fn-backref" href="#footnote-reference-4"&gt;2&lt;/a&gt;)&lt;/em&gt; “Why should I use \usepackage[T1]{fontenc}?”,
&lt;cite&gt;TeX - LaTeX Stack Exchange&lt;/cite&gt;.
Last modified 2017 April 13,
&amp;lt;&lt;a class="reference external" href="https://tex.stackexchange.com/a/677"&gt;https://tex.stackexchange.com/a/677&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="wiki-luatex" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-25"&gt;[15]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Wikipedia contributors,
“LuaTeX,”
&lt;cite&gt;Wikipedia, The Free Encyclopedia&lt;/cite&gt;.
&amp;lt;&lt;a class="reference external" href="https://en.wikipedia.org/w/index.php?title=LuaTeX&amp;amp;oldid=965669811"&gt;https://en.wikipedia.org/w/index.php?title=LuaTeX&amp;amp;oldid=965669811&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="xetex" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-26"&gt;[16]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;cite&gt;XeTeX - Unicode-based TeX&lt;/cite&gt;.
&amp;lt;&lt;a class="reference external" href="http://xetex.sourceforge.net"&gt;http://xetex.sourceforge.net&lt;/a&gt;&amp;gt;
(accessed 2020 July 27).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="Software"></category><category term="markup"></category><category term="LaTeX"></category><category term="XeLaTeX"></category><category term="LuaLaTeX"></category><category term="Unicode"></category><category term="UTF-8"></category><category term="encoding"></category></entry></feed>