Created
November 13, 2014 16:09
-
-
Save anonymous/99aa7c8dfe5022ab4c40 to your computer and use it in GitHub Desktop.
csquotes_test.tex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% see: http://tex.stackexchange.com/questions/211819/customizing-style-of-formal-block-quote-in-csquotes | |
% pdflatex test.tex; biber test; pdflatex test.tex; pdflatex test.tex | |
\documentclass{article} | |
\usepackage[utf8]{inputenc} % must have, to be able to enter {«}{»} for \MakeAutoQuote | |
\usepackage[T1]{fontenc} | |
\usepackage{unravel} | |
\usepackage[autostyle=tryonce,autopunct=true]{csquotes} | |
\usepackage[% | |
style=ieee, | |
isbn=true, | |
doi=false, | |
url=true, | |
defernumbers=true, | |
sorting=nyt, | |
%sorting=none, % "Do not sort at all. All entries are processed in citation order." (order of appearance) | |
firstinits=false, % shows full first name | |
backend=biber | |
]{biblatex} | |
\usepackage[UKenglish,USenglish]{babel} | |
\addbibresource{biblatex-examples.bib} | |
% @book{knuth:ct:a, | |
% author = {Knuth, Donald E.}, | |
% title = {The \TeX book}, | |
% date = 1984, | |
\usepackage{xcolor} | |
\pagecolor{yellow!10} | |
% [http://www.latex-community.org/forum/viewtopic.php?f=44&t=5444 csquotes package question • Text Formatting • LaTeX Community] | |
% \renewenvironment{quoteblock}{\openautoquote}{\closeautoquote} % quoteblock has been removed from csquotes! | |
% \renewcommand{\mkblockquote}[4]{\openautoquote{\itshape#1#2}#4#3\closeautoquote} % <--! works, but changes all | |
% from tex/latex/csquotes/csquotes.def: | |
% http://de.comp.text.tex.narkive.com/bQLQv3EF/csquotes-und-blockquote | |
\DeclareQuoteStyle[italics]{english}% | |
[\itshape]% Initialization for level 1 (outer); \emph nowork, only \itshape | |
[\normalfont]% Initialization for level 2 (inner) | |
{>\typeout{YYYYYYYY}\textquoteleft} % outer open | |
{\textquoteright<} % outer close | |
[0.05em] | |
{>{>}\textquotedblleft} % inner open | |
{\textquotedblright<{<}} % inner close | |
\DeclareQuoteAlias[italics]{english}{ITenglish} % ignored? must have, so csq@qstyle@english/italics gets defined...; doing [italics]{english}{USenglish} crashes things "! Extra \else." | |
% \mkblockquote is called from \long\def\csq@bquote@iii#1#2#3#4#5#6#7#8{% | |
% -> \begin{\csq@blockenvironment}% ... \mkblockquote | |
% \csq@blockenvironment: default value is "quote" | |
% http://tex.stackexchange.com/questions/39285/whats-the-advantage-of-using-csquotes-over-using-an-editors-auto-replacement-f | |
\begin{document} | |
\hyphenquote{UKenglish}{quote with UK English hyphenation} | |
% \ExecuteQuoteOptions{english=italics} % only in preamble! | |
% \setkeys{csq}{english=italics} % only in preamble! | |
% \setquotestyle{debug} % ok | |
\setquotestyle[italics]{english} % also disables multilingual! | |
\textcquote[1]{knuth:ct:a}{formal quote} | |
% \enquote resolves inner quote | |
\hyphentextcquote{UKenglish}[1]{knuth:ct:a}{formal quote \enquote{with UK} English hyphenation} | |
\MakeOuterQuote{"} % does not resolve inner quote | |
\hyphentextcquote{UKenglish}[1]{knuth:ct:a}{formal quote "with UK" English hyphenation} | |
% for MakeAutoQuote, there is: \csq@validate: | |
% \csq@ifutfchar {#1} {\csq@ifvalidutf {#1} ... | |
% so cannot just use e.g. {z}{x} - "Error: Invalid argument." | |
\MakeAutoQuote{«}{»} % does not resolve inner quote | |
\hyphentextcquote{UKenglish}[1]{knuth:ct:a}{formal quote «with UK» English hyphenation} | |
\hyphenblockcquote{UKenglish}[1]{knuth:ct:a}{A long formal quote with UK English hyphenation which \enquote{happens to be longer than three lines}, thus, is typeset as a block quote. This text is just to make it long enough. This text is just to make it long enough. This text is just to make it long enough.} | |
\makeatletter | |
% \KV@split #1==\relax \expandafter \KV@do | |
% % \KV@prefix should be KV@csq@ | |
\typeout{IT IS: \meaning\KV@csq@english ; \meaning\csq@qstyle@english ; \meaning\csq@qstyle@UKenglish ; \meaning\expandafter\csuse{csq@qstyle@english/italics}} % \DeclareQuoteAlias [#1]{english}{english} ; macro:->\csuse {csq@qstyle@english/american} ; macro:->\csuse {csq@qstyle@british} ; expandafter\def \let 13sp13sp..... | |
% \def\csq@qstyle@english{\csuse{csq@qstyle@english/italics}} | |
\let\oldbqph\blockquote@parsehook | |
\gdef\blockquote@parsehook{EEEEE\typeout{ZZZZZZ}\oldbqph IIIIII} % all the characters here are gobbled | |
% \let\oldbqprh\blockquote@posthook | |
% \gdef\blockquote@posthook{\oldbqprh} % para starts way after this | |
\typeout{IS: \csq@blockenvironment} % IS: quote | |
\makeatother | |
% \DeclareQuoteAlias[italics]{english}{english} % only in preamble | |
% \csxdef {csq@qstyle@#3}{\noexpand \csuse {csq@qstyle@\csq@tempa }}} | |
\setquotestyle* % enable multilingual again | |
% \unravel{ % 14840 steps for this! but messes output... | |
% to get full stack trace, call `yes "" | pdflatex test.tex` | |
% but those 14840 steps don't even come to unraveling csq@bquote@iii (so \mkblockquote is visible)! | |
% \typeout{languagename \languagename} % for {english}: languagename USenglish | |
% for \hyphenblockcquote{ITenglish}: ! Missing number, treated as zero. <to be read again> \l@itenglish | |
\hyphenblockcquote{english}[1]{knuth:ct:a}{ A long formal quote with UK English hyphenation which \enquote{happens to be longer than three lines} and, thus, is typeset as a block quote. This text is just to make it long enough. This text is just to make it long enough. This text is just to make it long enough.} | |
% } | |
\printbibliography[sorting=none] | |
\end{document} | |
% http://tex.stackexchange.com/questions/54679/language-sensitive-italicized-quotation-with-csquotes | |
% \renewcommand{\mktextquote}[6]{% | |
% #1% | |
% \iflanguage{english}{\itshape}{}% ADDED - nope | |
% #2#4#3#6#5% | |
% } | |
% \renewcommand{\mkblockquote}[4]{% | |
% \iflanguage{english}{\itshape}{}% ADDED - nope | |
% #1#2#4#3% | |
% } | |
% [http://www.latex-community.org/forum/viewtopic.php?f=44&t=5444 csquotes package question • Text Formatting • LaTeX Community] | |
% "BUT if the quote is set as a block there are no quotation-marks anymore. How can I change this?" | |
% \renewenvironment{quoteblock}{\openautoquote}{\closeautoquote} % quoteblock has been removed from csquotes! | |
% http://tex.stackexchange.com/questions/175897/quotations-spanning-multiple-paragraphs-in-csquotes-with-french-guillemets-under/211812#211812 | |
% http://tex.stackexchange.com/questions/211819/customizing-style-of-formal-block-quote-in-csquotes | |
% (had to code entire program, visRegexTester.py, to be able to find this right regex: | |
% grep '\\mk' testb.log | sed 's/.*\(\\mk[^ ]*\).*/\1/gp' | sort | uniq | less | |
% ... and to confirm that, using unravel, \mkblockquote is called nowhere from \hyphenblockcquote (only \mkbibquote and \mktextquote) !? | |
% \mktextquote = \long macro:#1#2#3#4#5#6->#1#2#4#3#6#5 followed by | |
% \csq@oqopen@i = macro:->\advance \csq@qlevel \@ne \csq@qopen | |
% \csq@qopen = macro:->\ifnum \csq@qlevel >\csq@m... \csq@thequote@oopen \csq@thequote@oopen ... -> \csuse {csq@thequote@oopen} | |
% \csq@thequote@oopen = macro:->\textquotedblleft | |
% around step Step 3542 can see - apparently, it does push in the quote text twice, apparently once without quotes, once with - and somehow this is selected as block eventually | |
% to strip code comments & blank lines: | |
% cloc --strip-comments=nc --inline test.tex # had to hack it for tex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment