texlive[43724] Master: easyformat (9apr17)

commits+karl at tug.org commits+karl at tug.org
Mon Apr 10 00:40:10 CEST 2017


Revision: 43724
          http://tug.org/svn/texlive?view=revision&revision=43724
Author:   karl
Date:     2017-04-10 00:40:10 +0200 (Mon, 10 Apr 2017)
Log Message:
-----------
easyformat (9apr17)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/easyformat/
    trunk/Master/texmf-dist/doc/latex/easyformat/README
    trunk/Master/texmf-dist/doc/latex/easyformat/easyformat.pdf
    trunk/Master/texmf-dist/doc/latex/easyformat/easyformat.tex
    trunk/Master/texmf-dist/tex/latex/easyformat/
    trunk/Master/texmf-dist/tex/latex/easyformat/easyformat.sty
    trunk/Master/tlpkg/tlpsrc/easyformat.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/easyformat/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/easyformat/README	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/easyformat/README	2017-04-09 22:40:10 UTC (rev 43724)
@@ -0,0 +1,16 @@
+easyformat is a package that allows the use of _ (the underscore) to add italics and bold text.
+
+Usage:
+Import the package with: \usepackage{easyformat}
+
+Now you can do the following in textmode:
+_italics_, __bold__, ___bolditalic___.
+
+The underscore's (_) meaning in mathmode stays the same.
+
+(See easyformat.pdf for more info.)
+
+
+A package by Evert Provoost, licensed under GPLv3.
+
+Made with <3 in Berlaar, Belgium.


Property changes on: trunk/Master/texmf-dist/doc/latex/easyformat/README
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/easyformat/easyformat.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/easyformat/easyformat.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/easyformat/easyformat.pdf	2017-04-09 22:39:28 UTC (rev 43723)
+++ trunk/Master/texmf-dist/doc/latex/easyformat/easyformat.pdf	2017-04-09 22:40:10 UTC (rev 43724)

Property changes on: trunk/Master/texmf-dist/doc/latex/easyformat/easyformat.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/easyformat/easyformat.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/easyformat/easyformat.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/easyformat/easyformat.tex	2017-04-09 22:40:10 UTC (rev 43724)
@@ -0,0 +1,149 @@
+% !TeX spellcheck = en_GB
+
+\documentclass[a4paper, 11pt]{article}
+\usepackage[british]{babel}
+\usepackage[hidelinks]{hyperref}
+\usepackage{microtype}
+\usepackage{easyformat}
+
+\def\labelitemi{--}
+
+\def\easyformat{\texttt{easyformat}}
+
+\title{\easyformat\\[.5em]
+		\large _the_ manual for the 2017/04/09 version (v1.1.0)}
+
+\author{Evert Provoost}
+
+\date{}
+
+\begin{document}
+
+	\maketitle
+	
+	\begin{abstract}
+		\easyformat\ is a package that allows the use of~\_ to begin/end _italic_ or __bold__ formatting as an alternative to the standard \LaTeXe\ \verb|\textit{italic}| and/or \verb|\textbf{bold}|.
+	\end{abstract}
+
+	%\tableofcontents % NOT NEEDED
+	\newpage
+	
+	%% NOT NEEDED.
+	% Insert a blank page.
+	%\null % The page has to contain 'something'.
+	%\thispagestyle{empty} % Hide the pagenumber.
+	%\addtocounter{page}{-1} % So the next doesn't turn 3.
+	%\newpage
+	
+	\section{Introduction}
+	Usually when you want to make something _italic_ or __bold__ in \LaTeX\ you insert \verb|\textit{italic}| or \verb|\textbf{bold}| respectively.
+	
+	However when writing a book or another text where this formatting is common, this quickly becomes annoying to type.
+
+	\begin{quote}
+	__Quick disclaimer:__\\
+	I'm not saying that the \LaTeX\ way is bad. I just want to explain that it's not ideal under all circumstances.
+	\end{quote}
+	
+	Simple markuplanguages (eg. Markdown) have a more elegant solution.	
+	If you, for example, wanted to write:
+	\begin{quote}
+		__Stop!__, you _have_ to wait!
+	\end{quote}
+
+	In Markdown, you'd type:
+	\begin{quote}
+		\verb|**Stop!**, you *have* to wait!|
+	\end{quote}
+
+	As you can see it's a matter of _wanting_ italic or bold formatting, adding~*'s where needed and done; no (long) macros to type.
+	
+	With the help of \easyformat\ we can do something similar, here we get the same result with:
+	\begin{quote}
+		\verb|__Stop!__, you _have_ to wait!|
+	\end{quote}
+	
+	(Why underscores? See: \ref{Why?!})
+	
+	\section{Usage, syntax and examples}
+	Like usual you import the package with: \verb|\usepackage{easyformat}|
+
+	\easyformat\ makes \_ an active character, however it was already 'special' before so you still have to type~\verb|\_| if you want to insert an underscore.
+
+	As already said, \easyformat\ uses a Markdown-like syntax, so:
+	
+	\begin{quote}
+		\verb|_italic,_ __bold,__ and ___bolditalic!___|
+	\end{quote}
+
+	Gives:
+	\begin{quote}
+		_italic,_ __bold,__ and ___bolditalic!___
+	\end{quote}
+
+	However we can also do more complex stuff, eg.:
+	\begin{quote}
+		\verb|_Lorem __ipsum_ totalem__ da __givea _zin_ doram__ _zet_tim, liefkan.|
+	\end{quote}
+	
+	Becomes:
+	\begin{quote}
+		_Lorem __ipsum_ totalem__ da __givea _zin_ doram__ _zet_tim, liefkan.
+	\end{quote}
+
+	Those with a good eye might have noticed that \easyformat\ adds italicscorrection when needed. Just like \verb|\textit{zet}tim| would have.
+	
+	\section{Utilities}
+	%% This is solved in version 2017/04/09
+	%\subsection{Underscore in subtitles\label{undtitles}}
+	%If you ever try something similar to \verb|\section{__Vectors:__ %$\vec{F}_g$}|: \TeX\ will shout at you. Why? I don't really know. However I %do know how to fix this. If we want to get the previous example we would use:
+	
+	%\begin{quote}
+	%	\verb|\setundsub|\\
+	%	% Yeah there's a glitch were the first is indented slightly more
+	%	% unless there is something before the next lines......
+	%	\hspace*{0pt}\verb|\section{$\textbf{Vectors:} \vec{F}_g$}|\\
+	%	\hspace*{0pt}\verb|\setundact|
+	%\end{quote}
+	
+	%This first resets the \_ character so it can only be used as the start of %subscripts; then adds the subtitle and afterwards re-initiates \_ for %__bold__ and _italic_. (Obviously the \easyformat\ syntax does not work %_in_ the subtitle, so you'll have to use the \LaTeX-commands.)
+	
+	\subsection{\texttt{\textbackslash nrshape}}
+	Reverts the fontshape to the default.
+	
+	\subsection{\texttt{\textbackslash nrseries}}
+	Reverts the fontseries to the default.
+	
+	\subsection{\texttt{\textbackslash setundact}}
+	Sets the catcode of \_ to 13 (active), effectively _(re-)enabling_ the \easyformat\ syntax.
+	
+	\subsection{\texttt{\textbackslash setundsub}}
+	Sets the catcode of \_ to 8 (subscript), effectively _disabling_ the \easyformat\ syntax.
+	
+	\section{Technical details}
+	\subsection{Why \_ and not *?\label{Why?!}}
+	To make * work we would have to make it an active character, however this would break things like \verb|\section*{Art}|. The~\_ is already protected by \TeX\ because of it's meaning in mathmode. However, it has little to no use in textmode. This is why we can use~\_ for this purpose and not~*.
+	
+	\subsection{Does this break mathmode?}
+	No it doesn't. It keeps behaving like before in mathmode, it's meaning only changes in textmode. (We first check whether we are in mathmode or not and behave accordingly.)
+
+	\section{Contact}
+	If you want to make suggestions or have any questions whose answer could be included in a future version of this document, you can email to this address: \url{mailto:evert.provoost at gmail.com}
+	\newpage
+	
+	\section{Changelog}
+	We only include important changes from v1.0.0 onwards, since earlier versions barely worked.
+
+	\subsection*{2017/04/09 v1.1.0}
+	Made usage of syntax in \verb|\section{}|, and similar macros, possible. Changed the behaviour so it works more like \verb|\emph{}| (this also simplifies the code).
+
+	\subsection*{2017/04/07 v1.0.0}
+	First stable version.
+
+
+	% Insert a friendly message :)
+	\vspace*{\fill}\noindent
+	Made with $\heartsuit$ in Berlaar, Belgium.
+	\clearpage
+
+\end{document}


Property changes on: trunk/Master/texmf-dist/doc/latex/easyformat/easyformat.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/easyformat/easyformat.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/easyformat/easyformat.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/easyformat/easyformat.sty	2017-04-09 22:40:10 UTC (rev 43724)
@@ -0,0 +1,152 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                       %
+% easyformat  Adds easier bolds and italics to LaTeX.                   %
+% Copyright (C) 2017  Evert Provoost <evert.provoost at gmail.com>         %
+%                                                                       %
+% This program is free software: you can redistribute it and/or modify  %
+% it under the terms of the GNU General Public License as published by  %
+% the Free Software Foundation, either version 3 of the License, or     %
+% (at your option) any later version.                                   %
+%                                                                       %
+% This program is distributed in the hope that it will be useful,       %
+% but WITHOUT ANY WARRANTY; without even the implied warranty of        %
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         %
+% GNU General Public License for more details.                          %
+%                                                                       %
+% You should have received a copy of the GNU General Public License     %
+% along with this program.  If not, see <http://www.gnu.org/licenses/>. %
+%                                                                       %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+%% NOTE TO FUTURE: Italics correction works because of \maybe at ic.
+%                  this macro might disappear in LaTeX3...
+%
+%                  If the New Font Selection Scheme would change,
+%                  stuff WILL break...
+
+
+%% Administration...
+\NeedsTeXFormat{LaTeX2e} % Why no date? We'll leave that to the imports.
+\ProvidesPackage{easyformat}
+	[2017/04/09 v1.1.0 Adds easier bolds and italics.]
+
+
+%% Import this handy package
+\RequirePackage{ltxcmds}[2011/04/18]
+
+
+%% Public macros
+% Add macros to switch the syntax on or off.
+\newcommand*{\setundact}{
+	\catcode`\_=\active
+}
+
+\newcommand*{\setundsub}{
+	\catcode`\_=8
+}
+
+% Add some macros which do small parts of what \normalfont does.
+\newcommand*{\nrshape}{%
+	\fontshape{\shapedefault}%
+	\selectfont%
+}
+
+\newcommand*{\nrseries}{%
+	\fontseries{\seriesdefault}%
+	\selectfont%
+}
+
+
+%% CONSTANTS
+% Yes I could use \sb but that is a dependency...
+\let\EFOR at subscript=_
+
+% To test what style we're currently in.
+\def\EFOR at it{it}
+\def\EFOR at bf{bx}
+
+
+%% UTILS
+% So we can remove an unnecessary undescore when starting/stopping bold.
+\newcommand*{\EFOR at util@removeChar}[1]{}
+
+% Do the first when in mathmode, the second if not.
+\newcommand*{\EFOR at util@ifmmode}{%
+	\ifmmode
+		\expandafter\@firstoftwo
+	\else
+		\expandafter\@secondoftwo
+	\fi
+}
+
+% Do the first when equal, the second if not (first or second of
+% what comes *after* \EFOR at util@ifx{...}{...} that is).
+\newcommand*{\EFOR at util@ifx}[2]{%
+	\ifx#1#2\relax
+		\expandafter\@firstoftwo
+	\else
+		\expandafter\@secondoftwo
+	\fi
+}
+
+
+%% Formating handling
+% Switch italics on or off.
+\newcommand*{\EFOR at handle@italic}{%
+	\EFOR at util@ifx{\f at shape}{\EFOR at it}
+	% \maybe at ic adds italics correction if needed.
+	% (might stop working in LaTeX3?)
+	{\nrshape\maybe at ic}
+	{\itshape}%
+}
+
+% Switch boldface on or off.
+\newcommand*{\EFOR at handle@bold}{%
+	\EFOR at util@ifx{\f at series}{\EFOR at bf}
+	{\nrseries}
+	{\bfseries}%
+}
+
+
+%% Activate the systems!
+% Prepare the syntax in the preamble.
+\setundact
+
+% Now finally add the new syntax in the document part.
+\AtBeginDocument{
+	% Just to be sure
+	\setundact
+	
+	% This is where the magic happens (also differentiates between
+	% the text and math mode.)
+	% It is \protected because it should work in eg. \section{}
+	\protected\def_{\EFOR at util@ifmmode
+		{\EFOR at subscript}
+		{\ltx at ifnextchar@nospace_
+			% \EFOR at util@removeChar removes the second underscore.
+			{\EFOR at handle@bold\EFOR at util@removeChar}
+			{\EFOR at handle@italic}%
+		}%
+	}
+}
+
+% Cleanup
+\AtEndDocument{
+	% Why no \def_\undefined?
+	% Because if we use this syntax in eg. \section{},
+	% the macro should still work in the .aux file...
+	\setundsub
+}
+
+
+%% DONE!
+\endinput
+
+
+%% IMPLEMENTATION DETAILS:
+%% Why not \textit/bf\bgroup and \egroup?
+%      Well actualy that was the original solution. Hwoever this
+%      doesn't differentiate between ending itallics or ending
+%      boldface. The current solution does and this makes the syntax
+%      more predictable and generally more useful.
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/easyformat/easyformat.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2017-04-09 22:39:28 UTC (rev 43723)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2017-04-09 22:40:10 UTC (rev 43724)
@@ -222,7 +222,7 @@
     dtxtut duerer duerer-latex duotenzor dutchcal
     dvdcoll dvgloss dviasm dviincl
     dvipsconfig dynamicnumber dynblocks dyntree
-  e-french ean ean13isbn easy easy-todo easyfig easylist easyreview
+  e-french ean ean13isbn easy easy-todo easyfig easyformat easylist easyreview
     ebezier ebgaramond ebgaramond-maths ebong ebook ebproof ebsthesis
     ec ecc ecclesiastic ecgdraw ecltree eco ecobiblatex econometrics economic
     ecv ed edfnotes edmac edmargin ednotes eemeir eepic efbox egameps

Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2017-04-09 22:39:28 UTC (rev 43723)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2017-04-09 22:40:10 UTC (rev 43724)
@@ -301,6 +301,7 @@
 depend easy
 depend easy-todo
 depend easyfig
+depend easyformat
 depend easylist
 depend easyreview
 depend ebezier

Added: trunk/Master/tlpkg/tlpsrc/easyformat.tlpsrc
===================================================================


More information about the tex-live-commits mailing list