I've written a text with 200 quotes. One quote example:
"Und wir haben die Liebe erkannt und geglaubt, die Gott zu uns hat. Gott ist Liebe, und wer in der Liebe bleibt, der bleibt in Gott und Gott in ihm" (1. Johannes 4,16)
The quote itself is indicated by blockquotes "" and can be running on different lines. The quote reference is given in round brackets (). I like to have the quote reference on one single line, because it looks ugly to have: (1. Johannes
on the end of one line and 4,16)
on the next line. So I have to replace all quotes which are always introduced by so called blockquotes " (
.
With the definition \newcommand{\nobreakword}[1]{\mbox{(#1)}}
in the preamble I can define that every () expression is not broken. I can search for all " (
and replace this expression with \nobreakword{(
. Consequently to finish the used code for the round brackets I have to replace also all )
with )}
.
For a fast repeating text replacement we can use almost every text editor which has a Find+Replace utility. I use TeXstudio (v.2.8.4) and press Ctrl+R in order to find and replace text. I'm sure this is no editor question and works in every editor. I'm flexible to use any other text editor (for Windows 8).
Instead of just using \nobreakword{(
I've to search for " (1. Johannes
and replace this with a code like this " \addtheentryinsidebracketstothefirstindex{1. Johannes}\nobreakword{(1. Johannes
so that the reference is not only save before line break but also included to a specific index entry.
The now used index is made with makeidx
and \index{Begriff!Subbegriff}
Because I have already used this normal index with some restrictions (vertical spacing between same letter as you see in my MWE) and an introducing text on a page before the regular index starts, I need to have a second index which lists the quotes in a specific way: 1. Korinther ..,.., Galater ..,.., 1. Johannes ..,.., 2. Johannes ..,.. So I need to define the index entries. So I have to define in the preamble somehow the order of this second index, because it's arbitrary, it's not alphabetically sorted (Hoheslied, Jeremia, Markus, Johannes, Römer, 1. Korinther, Galater, 1. Johannes, 2. Johannes)
The first index should look somehow like this:
Hoheslied
Hoheslied 8,4 1,3
Jeremia
Jeremia 31,3 1
Markus
Markus 10,19-21 1
Johannes
Johannes 3,16 1
Johannes 13,35 1,2
Johannes 15,9 1
Römer
Römer 5,8 1
1. Korinther
1. Korinther 16,14 2
Galater
Galater 5,22 3
1. Johannes
1. Johannes 4,16 4
1. Johannes 4,18-21 4,5
2. Johannes
2. Johannes 1,3 2
It would be cool if I can search for " (1. Johannes
and replace all findings with \addtonewindex{1. Johannes}\nobreakword{
or somehow like that for all findings e.g. " (1. Johannes 4,16)
and " (1. Johannes 4,18-21)
. Is it somehow possible to do this with a specific replace text pattern?
In the last page of the PDF generated with the following code I've written how I prefer to have this index entries (starting with a new page).
\documentclass[a4paper,latin,fontsize=10pt,headsepline,parskip=half-,index=totoc]{scrreprt}
\areaset[0pt]{160mm}{247mm}% no binding correction, text width is 160mm, text height is 247mm; with twoside=semi, the margins will be
\usepackage[a4paper,margin=2.5cm]{geometry} %needed for multicol package
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage[normalem]{ulem}
\usepackage{fancybox,calc,etoolbox,lipsum,multicol}
\usepackage[osf,sc]{mathpazo}
\usepackage[intoc]{nomencl}
\renewcommand{\nomname}{Glossar}
\makenomenclature
\usepackage{scrlayer-scrpage}% scrpage2 is obsolete
\pagestyle{scrheadings}
\clearpairofpagestyles% \clearscrheadings, \clearscrplain are deprecated
\automark[chapter]{chapter}
\ihead[]{\headmark}
\ohead[\pagemark]{\pagemark}
\renewcommand*\partpagestyle{empty} % removes the pagenumbers of all part pages
\usepackage{imakeidx} % must always be loaded before the hyperref package, otherwise it can cause problems!
\usepackage[colorlinks,pdfpagelabels,pdfstartview = FitH,bookmarksopen = true,bookmarksnumbered = true,linkcolor = black,plainpages = false,hypertexnames = false,citecolor = black] {hyperref}
\title{Einführung}
\author{Autor}
\date{1.Oktober 2014}
\newcommand{\nobreakword}[1]{\mbox{#1}}
% index
\usepackage{makeidx}
\makeindex[intoc,title=Stichwortverzeichnis] % no redefining is needed with \renewcommand{\indexname}{Stichwortverzeichnis} before \printindex
\makeatletter
\def\@idxitem{\par\addvspace{10\p@ \@plus 5\p@ \@minus 3\p@}\hangindent 40\p@}
\def\subitem{\par\hangindent 40\p@ \hspace*{20\p@}}
\def\subsubitem{\par\hangindent 40\p@ \hspace*{30\p@}}
\def\indexspace{}
\patchcmd\theindex{\indexname}{\indexname\vspace{12pt}}{}{}
\makeatother
% glossar
\renewcommand{\nompreamble}{\vspace*{-3mm}...Introducing Thoughts...\vspace*{4mm}} %text before glossar!
\makenomenclature % is obligatory to create the glossar!
\newcommand{\auferstehungtext}{Auferstehungstext} % is used for long glossar entries!
\begin{document}
\begin{titlepage}% if you need a custom layout - otherwise, use \maketitle
\centering
Titelseite
\end{titlepage}
\renewcommand{\contentsname}{Inhaltsverzeichnis}
\clearpage\pdfbookmark{\contentsname}{toc}
\tableofcontents\thispagestyle{empty}
\chapter{Gottes Liebe zu den Menschen(Seine Geschöpfe)}
\begin{flushright}\footnotesize\textit{ursprünglicher Beitrag vom 6. April 2014 überarbeitet}\end{flushright}
The text in the index
\doublebox{\begin{minipage}[t]{1\columnwidth}%
"Denn so hat Gott die Welt geliebt, dass er seinen eingeborenen Sohn gab, damit jeder, der an ihn glaubt, nicht verloren geht, sondern ewiges Leben hat." (Johannes 3,16)%
\end{minipage}}
\section*{Gottes Liebe zu den Menschen}
"Und wir haben die Liebe erkannt und geglaubt, die Gott zu uns hat. Gott ist Liebe, und wer in der Liebe bleibt, der bleibt in Gott und Gott in ihm" (1. Johannes 4,16)
\index{Wachstum im Glauben!Glaube}
"Der HERR ist mir erschienen von ferne: Ich habe dich je und je geliebt, darum habe ich dich zu mir gezogen aus lauter Güte."
(Jeremia 31,3)
"Denn so hat Gott die Welt geliebt, dass er seinen eingeborenen Sohn gab, damit jeder, der an ihn glaubt, nicht verloren geht, sondern ewiges Leben hat." (Johannes 3,16)
"Gott aber erweist seine Liebe zu uns darin, dass Christus, als wir noch Sünder waren, für uns gestorben ist." (Römer 5,8)
"Du kennst die Gebote: »Du sollst nicht töten; du sollst nicht ehebrechen; du sollst nicht stehlen; du sollst nicht falsch
Zeugnis reden; du sollst niemanden berauben; ehre Vater und Mutter.« Er aber sprach zu ihm: Meister, das habe ich alles gehalten von meiner Jugend auf. Und Jesus sah ihn an und gewann ihn lieb und sprach zu ihm: Eines fehlt dir. Geh hin, verkaufe alles, was du hast, und gib's den Armen, so wirst du einen Schatz im Himmel haben, und komm und folge mir nach!" (Markus 10,19-21)
\index{Lebensveränderung!Reden/Schweigen}
"Gnade, Barmherzigkeit, Friede von Gott, dem Vater, und von Jesus Christus, dem Sohn des Vaters, sei mit uns in Wahrheit und in Liebe!" (2. Johannes 1,3)
\section*{Liebe unter den Menschen}
"Furcht ist nicht in der Liebe, sondern die vollkommene Liebe treibt die Furcht aus; denn die Furcht rechnet mit Strafe. Wer
sich aber fürchtet, der ist nicht vollkommen in der Liebe. Lasst uns lieben, denn er hat uns zuerst geliebt. Wenn jemand spricht: Ich liebe Gott, und hasst seinen Bruder, der ist ein Lügner. Denn wer seinen Bruder nicht liebt, den er sieht, der kann nicht Gott lieben, den er nicht sieht. Und dies Gebot haben wir von ihm, dass, wer Gott liebt, dass der auch seinen Bruder liebe." (1. Johannes 4,18-21)
\index{Lebensveränderung!Nächstenliebe}
"Daran wird jedermann erkennen, dass ihr meine Jünger seid, wenn ihr Liebe untereinander habt." (Johannes 13,35)
"Wie mich mein Vater liebt, so liebe ich euch auch. Bleibt in meiner Liebe!" (Johannes 15,9)
"Ich beschwöre euch, ihr Töchter Jerusalems: Erregt und erweckt nicht die Liebe, Bis es ihr gefällt!" (Hoheslied 8,4)
"Alle eure Dinge lasst in der Liebe geschehen!"
(1. Korinther 16,14)
"Die Frucht des Geistes aber ist Liebe, Freude, Friede,Langmut, Freundlichkeit, Güte, Treue, Sanftmut, Selbstbeherrschung."
(Galater 5,22)
\index{Bleibendes!Liebe}
\index{Lebensveränderung!Freude}\index{Lebensveränderung!Friede}
\index{Lebensveränderung!Freundlichkeit}
\index{Begriffe!Treue}
\addtocontents{toc}{\textbf{\sffamily \textcolor{white}{.}}\protect\par} %gives an empty line between Appendy and last chapter
\shorthandon{"}
\cleardoublepage
\thispagestyle{empty}
\vspace*{\fill}
\begin{center}
\Huge Anhang
\addtocontents{toc}{%
\protect\addvspace{0.5pc}% <------------- adjust to suit
\textbf{\sffamily Anhang}\protect\par
}
\end{center}
\vspace*{\fill}
\clearpage
\nomenclature{Begriff2}{Begriffserklärung2}
\nomenclature{Begriff3}{Begriffserklärung3}
% Glossar (define specifications and introducing text in preamble)
\printnomenclature[2.5 cm] % width of first column
% Index (define specifications and introducing text here)
\indexprologue{\vspace*{-7mm}
Different words in different columns
\begin{multicols}{3}
\begin{small}
first entry\\
second entry\\
third entry\\
fourth entry
\end{small}
\end{multicols}
\newpage
Bibelstellen-Index\\\\
\textbf{It should look like this:}\\
\\
Hoheslied\\
Hoheslied 8,4\hspace*{1cm}x\\
\\
Jeremia\\
Jeremia 31,3\hspace*{1cm}x,y\\
\\
Markus\\
Markus 10,19-21\hspace*{1cm}k\\
\\
Johannes\\
Johannes 3,16\hspace*{1cm}k,y\\
Johannes 13,35\hspace*{1cm}k\\
Johannes 15,9\hspace*{1cm}k\\
\\
Römer\\
Römer 5,8\hspace*{1cm}k\\
\\
1. Korinther\\
1. Korinther 16,14\hspace*{1cm}k\\
\\
Galater\\
Galater 5,22\hspace*{1cm}pg.k\\
\\
1. Johannes
1. Johannes 4,16\hspace*{1cm}k\\
1. Johannes 4,18-21\hspace*{1cm}k\\
\\
2. Johannes\\
2. Johannes 1,3\hspace*{1cm}\\
...\\
...\\
\vspace*{40mm}
\textbf{newpage}
\vspace*{10mm}
}
\printindex
\end{document}
How to recognize a pattern as a non-line-braking reference by find+replace with a command and include this reference automatically in a second index?
One possible solution could be to implement somehow this code suggestion:
\documentclass{article}
\usepackage{lipsum}
\makeatletter
\newcommand\myquote{\my@quote}
\def\my@quote#1(#2){``#1''~\mbox{(#2)}}
\makeatother
\begin{document}
{Und wir haben die Liebe erkannt und geglaubt, die Gott zu uns hat. Gott ist Liebe, und wer in der Liebe bleibt, der bleibt in Gott und Gott in ihm}\myquote(1. Johannes 4,16)
\end{document}
Do you know how to do this?